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!

print every nth line (sed or awk solution?)

Status
Not open for further replies.

pigna

Programmer
Nov 9, 2006
10
NL
Trying to print every nth line of a huge file. Normally when using gsed one can use sed -n '3~7p' to print every 7th row starting from the 3th one.

Working on AIX teh syntax sed -n '3,${p;n;n;n;n;n;n;}' is needed. However the problem is my file is to big so the param $p;n...... is becoming to large (5991 n's).

Is there a better way to do this in sed or awk?
 
To clarify. Depending on the filesize I need to read every n th row. The bigger the file the larger the number of lines I want to skip...
 
Thanks a lot that is already doing it. How simple can it be :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top