@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> guys, how can i delete anything which is not a number or a dot, using sed?
<0> or more specifically, remove the ') from the end of a string?
<1> s/)$//
<1> s/[^0-9.]//g
<0> cheers man, will try it :)
<2> hi
<1> boo
<3> s/\/dev\//
<3> echo $foo|sed s/\/dev\//
<1> s#/dev##
<3> ?
<3> ooo
<1> and use more quotes
<3> echo $foo|sed "s/\/dev\//"
<1> sed 's/\/dev//' would have worked, too
<3> echo "$foo"|sed "s/\/dev\//"



<3> ok
<4> echo "$foo" |sed -e 's@/dev/@@'
<4> rue_work: You are missing a closing /
<3> oh I get it
<1> ah, there was a trailing /
<1> didn't see it
<1> i get older...
<4> That's why you use a delimiter other than / when you have /'s in your pattern. ;)
<3> echo "$foo" |sed -e 's^/dev/^^'
<3> ?
<4> rue_work: Sure. You can use any delimiter except backslash.
<4> rue_work: Maybe you also mean s@^/dev/@@ anyway.
<3> oh good point
<1> rue_work: you want basename, as heiner alredy mentioned
<3> is that pcre?
<1> that's BRE
<4> No, sed uses BRE.
<3> o
<5> anyone know how to do `perl -pe 's/^\[[^\]]+\] //'` in sed?
<4> er, what does that do?
<4> sed 's/^[[][^]]\{1,\}] //'
<4> sed 's/^\[[^]]\{1,\}] //'
<4> Either of those should work.
<5> perfect, thanks
<4> BTW, perl -pe 's/^[[][^]]+] //' works just fine too.
<4> In BRE and ERE, \ is _not_ special inside []
<4> When perl implemented its regular expression language, it got confused on that point.
<3> haha, ok, my turn to ask a perl to bre! :)
<3> you guys must get that SO often
<3> I have to check my perl re as Its been a while
<3> ^(\w*) : \w+\s*\d*, size= \d+, Id= \d, bootable
<3> I just want the bit in teh () returned
<3> ?
<3> oh, hmm, just use perl eh?
<4> ^\([[:alnum:]_]*\) : [[:alnum:]_]\{1,\}[[:blank:]]*[[:digit:]]*, size= [[:digit:]]\{1,\}, Id= [[:digit:]], bootable$
<3> will that one work?
<3> ....
<3> oooo
<6> rue_work: echo " ^(\w*) : \w+\s*\d*, size= \d+, Id= \d, bootable" |sed -ne 's/.*(\(.*\)).*/\1/p' #\w*
<3> I need a longer notepad
<3> oh thats cute, the test machine dosn't have any partitions marked bootable
<3> cat foo | perc sed -e '^\([[:alnum:]_]*\) : [[:alnum:]_]\{1,\}[[:blank:]]*[[:digit:]]*, size= [[:digit:]]\{1,\}, Id= [[:digit:]], bootable$'
<3> ?
<3> I only want the first bit returned... in the ()
<3> I dont think I have the application of this quite right
<3> gnubien I dont think thats doing what you were expecting
<4> rue_work: Or it's not doing what you were expecting ... ;)
<4> rue_work: cat foo ?
<1> cat foo | grep uuoc
<1> erm...
<4> s/cat/</
<4> er, no.
<1> only within command substitution IIRC
<4> s/cat \([^|]*\) *|/<\1 /
<1> yay :)
<1> nerd ;)
<4> well, yeah :)
<3> uuoc?



<3> is he on acid
<3> ?
<4> uuoc = useless use of cat.
<3> its conceptual, I have output of a program that I'm piping into the filter
<4> OK, that's fine. ;)
<1> no, i'm not on acid.
<1> at least nobody told me.
<3> ok, I'm going to ***ume that windows always marks the partiton it runs from as bootable
<3> cause the linux machine dosn't have any marked as bootable
<1> where does sed come in?
<3> which is gonna screw me up a little
<3> ok, I have to 'detect' which drive I need to save the MBR from
<3> I have partition data in the form
<3> dev/hda1 : start= 63, size= 196497, Id=82
<3> (with preceeding / that mirc dosn't like)
<3> that I need to pick out that its hda I'm working with
<3> then I can run dd to grab the mbr and all is good in my little bowl
<1> /test
<1> mh
<1> "//"?
<3> like -> /dev/hda1 : start= 63, size= 196497, Id=82
<4> /it works for me.
<3> depends on the client, I'm in mirc :(
<4> use slash space slash ...
<3> anyhoo
<4> "anywho"
<3> anything starting with / is taken as a command
<3> even if preceeded with whitespace
<1> additionally, xchat seems to detect filenames (i.e. multiple slashes in one string) and doesn't treat the line as /command then
<1> /home/bonsai/net/CONFIG/bashrc_common
<3> anyhow! :)
<1> yep
<3> one line in the partition file will have ,bootable on the end
<3> thats my key
<3> I need to know its hda from a line like /dev/hda1 : start= 63, size= 196497, Id=82, bootable
<3> is sed the right tool?
<3> |sed -e 're' |
<4> sed -e '/bootable$/!d;s/^\([^[:blank:]]*\).*/\1/'
<3> deb-wrkstn:~# sfdisk -d /dev/hda | sed -e '^\([[:alnum:]_]*\) : [[:alnum:]_]\{1,\}[[:blank:]]*[[:digit:]]*, size= [[:digit:]]\{1,\}, Id= [[:digit:]], bootable$'
<3> sed: -e expression #1, char 1: unknown command: `^'
<1> -n '/bootable$/s#^\([^ ]*\) .*#\1#'
<1> something around these lines
<1> er
<1> -n '/bootable$/s#^\([^ ]*\) .*#\1#p'
<3> prec got it
<3> kinda
<1> oh, didn't see that
<3> need to drop the parition number on the result, which I didn't remember to say
<1> i really should think about a bed
<3> I dont think I understand hte regex enough to mod it
<3> ok, you start by checking the end of the line
<3> I think !d rewinds the input
<3> ; is and end of op
<3> then we have a .... replace...
<3> that takes the beggining of the input...
<3> and
<3> literal bracket new beggining starting with a blank
<3> this is nested isn't it!!!!????
<3> whats \1
<3> not end of string...
<4> \1 is the text captured by the first capture group.
<3> 8|
<3> ~ ~~ ~~~ 8|
<3> replace start of string (start of string.whitespace)any amount then a \ with any number of any character after it with the first captured text
<3> oh the brackets are escaped
<3> so its like /bootable$/!d; s/^([^[:blank:]]*).*/\1/
<3> so if the line matches 'bootable$'
<3> run the replace against it
<3> s/^([ ^[:blank:] ]*).*/\1/
<3> the outside starts with
<3> I think it takes up to the start of hte first whitespace
<3> but I dont know how it knows what to replace it with
<3> oh darn, I'm out of time


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #sed
or
Go to some related logs:

libesddsp cannot be preloaded ubuntu
#perl
linux realtek alc850 menuconfig
dpkg kernel root partition md0 ubuntu
suse 10 error: db4 error(-30978) from db->close: DB_RUNRECOVERY: Fatal error, ru
get_client_info perl
#bash
websvn templates
kubuntu-desktop package
#centos



Home  |  disclaimer  |  contact  |  submit quotes