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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you print every nth record in a file 4

Status
Not open for further replies.

bigbalbossa

Programmer
Mar 21, 2002
87
US
Of course you can...but this has turn into a HUGE hassle. I simply need to read a file and print every 15th record...thoughts?
 
Try this:
Code:
perl -ne 'print unless ( $. ) % 15' filename
 
Ah, the modulus operator... Such a wonderful tool. Have a star ishnid.

- George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top