The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-14-2008
dala dala is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 7
Quote:
Originally Posted by otheus View Post
How do you know which lines you want and which you don't?

Let's say you want 3 lines, skip 3 lines, etc. Here's just one way (using GNU awk):


Code:
 awk '(int((FNR-1)/ 3))%2 == 0'  filename
Thx otheus, to answer your question, I am using `grep "^first"`, when I found it I would continue and grep for the "^second" word and so on.