r*u 发帖数: 63 | 1 How to print the odd (or even) lines of a file to another file? |
r*****s 发帖数: 985 | 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 发帖数: 63 | 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 发帖数: 1879 | 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 发帖数: 63 | 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 发帖数: 162 | 6
perl -pe'$_ x=$.&1'
【在 r*u 的大作中提到】 : How to print the odd (or even) lines of a file to another file?
|