[lug] Output every xth line?

The Matt thompsma at colorado.edu
Fri Nov 21 15:16:46 MST 2003


Folks, I need your Unix knowledge.  I have an input file that contains
data that isn't marked nice enough that I can use grep to parse it.

Rather, I find I need a script that says "starting with line x, output
that line and every yth line after it".  That is, start at line 5 and
output line 5, 5+y, 5+2y, &c.  Can you think of a quick shell script
that can do this?  My attempts have been rather laughable mainly because
I am neither a perl hacker or a shell script hacker.  (I could make one
in Fortran 95, but it wouldn't be very portable.)

Any help for the poor grad student?

Matt
-- 
I am a theoretical chemist.  Fear me!
 Matt Thompson -- http://ucsub.colorado.edu/~thompsma/
 440 UCB, Boulder, CO  80309-0440
 JILA A510, 303-492-4662
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20031121/a04bbfa7/attachment.pgp>


More information about the LUG mailing list