由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - a beginner's question
相关主题
请教How to adjust man output?Help: failed to compile cxterm with cc
awk questionChange shell to tcsh?
reverse the lines?[转载] Spidering BBS....
双面打印不好意思,问个问题
how to print the last 2 columns of a text file?how to convert csh shell script to dos batch file
Help about printing through network!about syslog.conf
My thought Re: beginner's question: Emacs vs. vi[转载] UNIX下的strtok
[转载] recommend good UNIX C programming books?how to change the date attribute of a file
相关话题的讨论汇总
话题: beginner话题: odd话题: enscript话题: question话题: lines
进入Unix版参与讨论
1 (共1页)
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?
1 (共1页)
进入Unix版参与讨论
相关主题
how to change the date attribute of a filehow to print the last 2 columns of a text file?
shell programming problem?Help about printing through network!
Re: No Shell problem!My thought Re: beginner's question: Emacs vs. vi
Help: One question about checksum in Unix[转载] recommend good UNIX C programming books?
请教How to adjust man output?Help: failed to compile cxterm with cc
awk questionChange shell to tcsh?
reverse the lines?[转载] Spidering BBS....
双面打印不好意思,问个问题
相关话题的讨论汇总
话题: beginner话题: odd话题: enscript话题: question话题: lines