Reply
Thread Tools
Posts: 526 | Thanked: 99 times | Joined on Sep 2009
#11
once again ignore, my I have friday fingers and I'm mistyping everywhere :-)
__________________
Christopher Stobbs

My Blog

Last edited by stobbsc; 2010-04-09 at 10:45.
 
Posts: 526 | Thanked: 99 times | Joined on Sep 2009
#12
does anyone know what the syntax would be for changing this part of the sed function

'/00:BD:3A/p'
to include multiple codes I've tried a few things but can't crack it jsut yet :-(
__________________
Christopher Stobbs

My Blog
 
Posts: 3,617 | Thanked: 2,412 times | Joined on Nov 2009 @ Cambridge, UK
#13
Originally Posted by stobbsc View Post
does anyone know what the syntax would be for changing this part of the sed function

Code:
/00:BD:3A/p'
to include multiple codes I've tried a few things but can't crack it jsut yet :-(
It should be just the same as you had before:
Code:
'/00:BD:3A\|00:BD:3B\|00:21:9E/p'
 
Posts: 526 | Thanked: 99 times | Joined on Sep 2009
#14
awesome that is perfect, I'm almost done, and learning loads along the way

one last thing for some reason, and I'm hoping it's not my typos again but I'm trying to do this and it isn't working
'$mycode'

where mycode="/00:BD:3A\|00:BD:3B\|00:21:9E/p"

not the end of the world, but would make my code neater.

The other thing is that I been looking in tutorials and finding out how to makea new line ect in a string
so I have
mystrin="$1\n Well done you found me"

the \n doesn't create a linebreak.

Thanks for all the help
__________________
Christopher Stobbs

My Blog
 
Posts: 3,617 | Thanked: 2,412 times | Joined on Nov 2009 @ Cambridge, UK
#15
Originally Posted by stobbsc View Post
awesome that is perfect, I'm almost done, and learning loads along the way

one last thing for some reason, and I'm hoping it's not my typos again but I'm trying to do this and it isn't working
'$mycode'

where mycode="/00:BD:3A\|00:BD:3B\|00:21:9E/p"

not the end of the world, but would make my code neater.
That's probably because you're using single quotes rather than double quotes, but I can't be sure without seeing the context.

Originally Posted by stobbsc View Post
The other thing is that I been looking in tutorials and finding out how to makea new line ect in a string
so I have
mystrin="$1\n Well done you found me"

the \n doesn't create a linebreak.
That depends on where you're using it. If you're using it with echo, you'll need to use "echo -e" instead to tell it to interpret escape codes.
 
Posts: 526 | Thanked: 99 times | Joined on Sep 2009
#16
with regards to the context of the first question it's to do with this line of code
a=`hcitool scan | sed -ne 's/^[\t]\(..:..:..\).*$/\1/' -e '/00:BD:3A\|00:19:1D/p'`
I want to start those hex codes in a variable.

With regards to the second one, I'm putting the line break into a string varialbe and then trying to output that string to the N900 notifcations screen. (the yellow bar)
the string pops up in the yellow bar but it contains the letter n instead of making the break.
__________________
Christopher Stobbs

My Blog
 
Posts: 3,617 | Thanked: 2,412 times | Joined on Nov 2009 @ Cambridge, UK
#17
Originally Posted by stobbsc View Post
with regards to the context of the first question it's to do with this line of code

I want to start those hex codes in a variable.

With regards to the second one, I'm putting the line break into a string varialbe and then trying to output that string to the N900 notifcations screen. (the yellow bar)
the string pops up in the yellow bar but it contains the letter n instead of making the break.
Okay - I think the issue is the same with both of these - try using two backslashes instead of one. When the script substitutes the variable, it'll interpret the backslash as being used to escape the following character, so stripping it from the string. A double backslash will mean the variable substitution still leaves one backslash to get passed though. Depending on where you're assigning/using variables, you may need even more backslashes (it can get very messy).
 

The Following User Says Thank You to Rob1n For This Useful Post:
Posts: 526 | Thanked: 99 times | Joined on Sep 2009
#18
cool thanks that helps a lot I'll play more tonight :-)
__________________
Christopher Stobbs

My Blog
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#19
The general rule-of-thumb I'm following is that as soon as the shell script starts to become a bit complicated it's time to change it to a Perl script! (It'll be faster too, if the original does a lot of awk/sed/other-application activations)
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 
Reply


 
Forum Jump


All times are GMT. The time now is 18:52.