dwgi32
1
Hi,
I would like to ask if there is any method to grep a chuck of lines based on the latest file in a directory.
E.g
Latest file in the directory:
Line 1: 532243
Line 2: 123456
Line 3: 334566
Line 4: 44567545
I wanted to grep all the line after line 2 i.e. Line 3 and line 4 and then writing them in a file.
Cheers
is your pattern is fixed??
I mean pattern is always 123456??
or you want to print only line 3 and 4 from all files??
clx
3
@dwgi32: from grep, you mean to say the output of lines itself?
you want the output of the latest file from third line onwards in a new file?
dwgi32
4
Yes, the pattern is fixed
---------- Post updated at 07:04 PM ---------- Previous update was at 07:02 PM ----------
Yes. > a.txt
awk '/Line 2/{f=1;next};f' file
tail +3 <latest-file> | grep 123456 > new_file.txt