| |
| |
| |
|
Comments:
<0> Does a single command exist which overwrites a file with only its last <x> lines? <0> sed -i -e :a -e '$q;N;<lines+1>,$D;ba' <filename> <1> hey guys, I am trying to find the largest partition based on the output of mac-fdisk /dev/blah would you guys help me with the sed command? here is the output http://keanmarine.com/cool and I have something like mac-fdisk -l /dev/hda | sed '1,6d' | sed 's/\*/ /' | sort -k 4 -g | tail -n 1 | gawk '{print $1}' <1> but im not sure if that will produce the largest partition every time <1> any one have any idea? <1> thanks, i will be around if anyone catches this:) <2> hi all
<2> I want to print all lines of a files except those which contain INET <2> and want to repace tcp TCP which comes after the line containing INET <2> any idaes how? <3> payal: sed -n '/INET/!p' filename <4> sed '/INET/d' filename ;) <3> payal: sed '/INET/{n;s/tcp/TCP/}' filename <2> was on phone <4> '/INET/{d;n;s/tcp/TCP/}' <2> gnubien: sed '/INET/{n;s/tcp/TCP/}' - this prints out line havig INET <4> payal: '/INET/{d;n;s/tcp/TCP/}' <2> iSteve: are you sure? <4> ... <2> no further processing is done on Deleted line <2> RIP <4> I am absolutely positive. <4> There's the "n" there, too <4> (viz man sed.) <2> it does not work <4> sed --version <2> GNU sed version 4.1.4 <4> $ echo -e "INET\ntcp" | sed '/INET/{d;n;s/tcp/TCP/}' <4> tcp <4> I can with gnu sed 4.1.5 <4> oh crap, I can see the problem now
<2> no no after line is deleted control is p***ed to next line and first command of the script <2> any ideas anyone? <4> well <4> it's easy with -n <2> how? <4> sed -n '/INET/ {n; s/tcp/TCP/; p;}' <4> hmm <2> nope <4> uno momento <2> it prints only one line that after INET <4> sed -n '/INET/ {n; s/tcp/TCP/;}; /INET/!p' <4> there, done <4> (next time provide sample input:) <2> sorry and thanks a lot <2> in n; s/tcp/TCP/; ---> is the last ; needed <4> No. Can't you try out _yourself_? <2> yes I tried it but was wondering why you gave it <4> oh I just like to:) <1> hey guys, do you know a way to make a progress bar for cp -a? <5> yes. patch cp. <4> or use rsync or scp ;) <4> you could also use cp -av and then sed the hell out of the output;) <5> a progress bar implies you know the value of 100% <5> which is not even true for cp -a <5> at the beginning i mean <4> you can still get some sort of dotbar <4> which might be enough for our poor user
Return to
#sed or Go to some related
logs:
#perl freeze.py gentoo #physics #ubuntu #centos #ubuntu #lgp mysql date returned in american format nokia_dku2 ubuntu ubuntu xlib.h
|
|