I have file with 10000 records and i need to delete the lines in single shot based on line number range say from 10 to 51 , 53 to 59 , 105 to 107, 311 to 592 etc... between range works fine for me but how to achive for above case? please help
sed '10,51 {d}' infile > outfile
bottom up way:
sed '311,592 d;105,107 d;53,59 d;10,51 d' infile > outfile
Thanks that works for me
Why do you need bottom up?
sed '10,51d; 53,59d; 105,107d; 311,592d' file
works just as well (no dashes BTW)...
Yes, Bottom up is not needed. Thanks.
Or you could use Perl to edit the file in-place.
perl -pi.bak -e 's/^.*\n$// if grep /$./, (10..51, 53..59, 105..107, 311..592)' file
tyler_durden