Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start search & inverse search

Status
Not open for further replies.

Hagoromo

Programmer
May 20, 2007
1
ES
Hi,

I'm newbie in awk ;-)

I have a text file with 150000 records (lines), and
I need to start the search of a pattern in line 60000.
It's possible to do that?

Another question, I can make a inverse search (i.e.,
search a pattern from line 50000 to line 40000)?

Thanks in advance
 
I need to start the search of a pattern in line 60000
awk '/pattern/ && NR>=60000{print}' /path/to/input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Hagoromo said:
I can make a inverse search (i.e.,
search a pattern from line 50000 to line 40000)?
No, [tt]awk[/tt] does not have full file handling features. It can advance through the file only by reading line after line.

But why your problem needs that solution ? Why not simply search from record 40000 to 50000 and display the last ( or latest ) matches ?

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top