@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> another question. how can I match a string and require it to be on its own line .... so I want to match the string CONNECT ABC ... but I want to require it be the only contents of the line ...
<0> \n doesn't seem to work.
<0> s/\nCONNECT ABC\n/\nCONNECT XYZ\n/g
<1> ^ and $
<0> ahh... of course.
<0> thanks.
<0> if I do a s/^CONNECT .*ABC.*$/CONNECT XYZ/g because of the $, greediness of the .* should not be a factor ... is that true?
<1> erm ... no?



<0> so it would match stuff across line boundaries?
<0> hmm
<1> sed only reads one line at a time into the pattern space by default.
<0> so then it is going to be ok.
<0> thanks.
<1> Only by using N can you read more than one input line into the p-space.
<2> hello, i gave this line for example: "89.34.4.3:35673->161.53.178.240:6668" and i want stopig grep at first ":" for example to grep me only: "89.34.4.3" . Help ?
<1> s/:.*//
<2> thanks i solve it...
<3> liar!
<0> heh.
<4> Can anyone help me with some simple tab separated stuff?
<4> I'm making a tsv file for a bodyshop that needs a database of automobiles. Right now, the format is Model, Make, Year Year Year (all the years they were made) I need to make it so for every year it'll copy the model and make and put the two digit year as a new line
<5> hey guys
<5> sorry for the retarded question , but my one line sed script doesn't work
<5> s/foo/bar/ is the single line
<5> when i run sed foo.sed bar.txt i get
<5> sed: -e expression #1, char 2: Extra characters after command
<6> don't you need a -f flag or something to specify a script ?
<5> according to man sed [OPTIONS] are optional if you put sedfile inputfile
<5> heh
<5> ok
<5> it's actually valid for sedscript inputfile
<5> hey folks
<5> uhmmm..
<5> if I run sed something;something else will the hold space will be reset every ';'
<5> ?
<3> hmm?



<3> I don't understand, can you word it any better?
<1> csmanx: There are only three command which modify the hold space.
<1> sed never "resets" the hold space.
<5> prec: unless the process finishes
<1> csmanx: ! Yes, of course.
<1> csmanx: But then it's not really "reset", it just ceases to exist.
<5> right
<5> =)
<5> can I use \n* as 'any number of newline entries in block matching?
<1> In block?
<1> No, but \n* will match zero or more newlines in the pattern space.
<1> Note that you'll have to use N (or other) to actually put a newline in the pattern space -- sed's default cycle does not do this.
<5> prec: so /foo/,/bar/ won't put the block in pattern space ?
<1> csmanx: Indeed it will not.
<1> /foo/,/bar/ is an address
<5> prec: how can I dump all that in the pattern space?
<1> csmanx: N
<5> N will add the next line only, won't it?
<1> /foo/{:a /bar/!{N;ba } s/\n*//g }
<5> a loop
<5> so if not bar found add line to pattern space
<1> Yes. When you reach the s command above, you'll have the block in the pattern space.
<1> With embedded newlines.
<5> exactly
<5> after grouping \n* doesn't seem to work
<1> printf 'foo\naaa\n\nbar\n' |sed -e '/foo/{:a' -e '/bar/!{N;ba' -e '}' -e 's/\n*//g' -e '}'
<5> maybe the g =P
<5> i was doing s/bar/!{...} instead of /bar/
<5> ok guys
<5> here is the little challenge : i have something like <!-- <foo /> --> <foo /> <!-- <foo /> -->
<5> i just want to affect the one in the middle
<5> and if it's enclosed by <!-- .... --> I need to remove the enclosing only in 1 of them
<5> ^_^


Name:

Comments:

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






Return to #sed
or
Go to some related logs:

#css
ratpoison avar
erase rw-cd ubuntu
alinux pvr-150
msn display picture gaim
octave engineering mode
xmule permission denied
ubuntu live cd modify grub hd
install audiopci-97 ubuntu
perlbot phpbb



Home  |  disclaimer  |  contact  |  submit quotes