| |
| |
| |
|
Comments:
<0> I'm calling GNU sed with `sed -i -r -s -f foo.sed [123].txt'. One of the commands in foo.sed only needs to be applied to 2.txt; is there a way to care about filenames within foo.sed? <1> Doubt it. <0> Yeah. I'll implement some magic in the parent script. <1> probably better to use a shell script <1> Aye. <0> Is -rsi equilvalent to -i -r -s? <0> I know the -i has to be last.
<1> rsi is repetative strain injury ! <0> repetetive <1> heh <1> :-) <1> Should be, try it. <0> I got confused a moment ago because -ie worked but -if didn't :-) <0> The expression /foo/d deletes lines matching foo. How can I delete each line that matches foo, plus the following two lines? <0> Ah, /foo/,+2d <2> when there is a matching expression for this line I get an empty page..(cat install/conf.sim | sed "/START-$STR_SERVICE_UPPER/,/END-$STR_SERVICE_UPPER/d" > install/conf.sim) , but when I redirect to foo.tmp I get the result I want(cat install/conf.sim | sed "/START-$STR_SERVICE_UPPER/,/END-$STR_SERVICE_UPPER/d" > foo.tmp) also when it doesn't match it works as well.. Is there some buffer flag I'm missing or is this obvious you can't read and edit the page <1> codestr0m: you need to use a temp file, or if you have GNU sed, sed -i <1> also, don't use cat file | sed <1> sed 'sed;commands' file <2> goldfish: ty.. I ended up using a temp file and trying to make this as universal as possible.. *bsd doesn't usually have GNU sed does it? <1> no <1> temp file is the portable solution <1> sed 'blah' file > TMP_FILE && mv TMP_FILE file <1> you'll see that alot <2> goldfish: does move or copy make a difference.. like move is just swapping inodes or something? <2> ooh if you move you don't have to delete the tmp file afterwards <1> Indeed. <2> I was going to play with something like this.. find install/* -type f -name "*" | xargs cat | sed '/STARTss/,/ENDss/d' > <1> mv will not, change a file's inode <1> k <1> http://wooledge.org/mywiki/BashFaq#faq8 -- How can I recursively search all files for a string?
<2> any quick fixes on that line so I'm not pulling each file individually and thanks <1> Should be a good read for you, it's only small. <2> (oopse this is probably a case of missing something obvious. ) thanks <3> hi <3> how can i simply print out lines that match a given regexp from standar input? <2> there is an example for the regex part http://www.student.northpark.edu/pemente/sed/sed1line.txt and "$FOO" will work, but '$FOO' won't <1> Demian: sed -n '/regexp/p' <1> codestr0m: anything inside single quotes is taken literally, no interpolation occourse. <1> *occours <2> goldfish: he said he wanted to pull a variable from stdin.. (sed "/START-$STR_SERVICE_UPPER/,/END-$STR_SERVICE_UPPER/d" install/sim ) <1> oh <1> did he? <1> Hmmmmm. <4> hi I had to use sed on maxosx yeasterday, and I checked that the -i option was in that version of sed, because I had to edit the files. however, if I did "sed -i 's/foo/bar' *.dat" but if I did "sed -i -e 's/foo/bar' *.dat" it did what I expected except I got a copy of all .dat files which was named .dat-e ; Can anybody tell me what point i missed? <5> It seems you missed the man page which describes how to use the -i option. <5> Don't fret; not reading the manual may be a common mistake, but it is easily fixed. :) <4> I am not on macosx now, so I can't check it, but would it differ from GNU/sed I tested it in linux with a GNU sed, where it worked <5> I don't know, would it? <4> well it did not change anything to read the man yeasterday! <5> It seems that the -i option on GNU sed is slightly different than the -i option on BSD sed. <4> hmm <4> okay <4> thank you <4> so the difference in -i made me get the -e on all files <4> I will read the BSD man page next time I get near such a Mac beast ;) <5> mine says: ''-i _extension_'' <5> My GNU man page says ''-i_suffix_'' <4> okay
Return to
#sed or Go to some related
logs:
#mysql #perl glest 915GM attempted static link of dynamic #gimp capture-ntfs gentoo #debian all work and no play screensaver g++ ipcop gentoo AttributeError: 'NoneType' object has no attribute 'endswith'
|
|