How to print the odd (or even) lines of a file to another file?
r*s
2 楼
with enscript: % enscript -a odd(or even) -o outputfile.ps inputfile.name
【在 r*u 的大作中提到】 : How to print the odd (or even) lines of a file to another file?
r*u
3 楼
Thanks. Any way to do it without enscript?
【在 r*****s 的大作中提到】 : with enscript: : % enscript -a odd(or even) -o outputfile.ps inputfile.name
c*t
4 楼
1. use wc to count # of lines 2. generate odd #'s 3. create a sed script to delete those # lines
【在 r*u 的大作中提到】 : Thanks. Any way to do it without enscript?
r*u
5 楼
Thanks. I found another sed command that can do this. In a general case, beginning at line 3, print every 7th line, sed -n '3,${p;n;n;n;n;n;n;}' So I can modify it for printing odd or even lines.
【在 c*****t 的大作中提到】 : 1. use wc to count # of lines : 2. generate odd #'s : 3. create a sed script to delete those # lines
p*f
6 楼
perl -pe'$_ x=$.&1'
【在 r*u 的大作中提到】 : How to print the odd (or even) lines of a file to another file?