Tuesday 15 April 2014

sed - display specific lines in all files in a directory in linux -



sed - display specific lines in all files in a directory in linux -

i have 200 text files in folder f. want see lines 2-4 of files. have tried like:

$sed -n '2,5'p *.txt

but reads first file. can please help?

furthermore, might need send these lines new file, like:

$sed -n '2,5'p *.txt>path

my knowledge of linux basic, if have totally different solution, please more specific.

awk 'fnr>1&&fnr<5' *.txt > result.txt

linux sed

No comments:

Post a Comment