Get somes lines from one file
Hello there,
i need help, how can get some lines between 2 words? file is bigger.... Best regards |
Open the file and copy-paste?
|
:confused:
|
hummm, right, but i written script file, and i dont know to do :/
|
like....
perl -ne 'print if my_first_line .. my_second_line' big_file.txt > export.txt ex: perl -ne 'print if 1203 .. 3929' big_file.txt > export.txt so, i want use 2 words thks in advance |
perl -e 'print "Like";' -e 'print " This?"' > test.txt
Don't think you can use the -n loop to do this - or have i misunderstood? Using -n would be like perl -n -e 'code' somefile Interpreted as while (<>) { # code } Tested this and it works perl -n -e '!EOF' test.sh test2.sh > othertest.sh EDIT Think I misunderstood what he's trying to do!! |
grep -A 100 start file | grep -B 100 end | grep -v start | grep -v end
Where "file" is the target file name, "start" is the opening word, "end" is the closing word, 100 is maximum nuber of lines between "start" and "end". Extremely terrible, but maybe it encourages someone to post something more sophisticated :D |
Quote:
What criteria do you want to use to decide which parts of the file to select? |
you can use
sed -n '/FIRST_WORD/,/SECOND_WORD/p' big_file >reqd_file note: This will also contain the lines containing the FIRST_WORD and the SECOND_WORD. |
Matthew,
for ex: today, my "key" are in the line 244 tomorrow, my same "key" can be 230 or the other line Best Regards, ps. sorry about my english :( |
yes.....
works now.... :) after some experiences... its work ;) thks a lot |
All times are GMT -5. The time now is 05:36 AM. |