o*******e 发帖数: 31 | 1 The default action is print the line
when we use awk, but if I don't want
to print out the line, how can I do
that?
If I want to get rid of the empty line
in a file, can I just use awk or I need
to use sed? | h******a 发帖数: 198 | 2 awk '!/^$/' urfile
perl -pi -e 's/^$//g' urfile
sed -ne '/^$/!p' urfile
if using tcsh/csh, be careful of using !
【在 o*******e 的大作中提到】![](/moin_static193/solenoid/img/up.png) : The default action is print the line : when we use awk, but if I don't want : to print out the line, how can I do : that? : If I want to get rid of the empty line : in a file, can I just use awk or I need : to use sed?
| o*******e 发帖数: 31 | 3 what shell do u use?
so awk/perl/sed should be shell independent?
BTW, what is the meaning of '$!' in awk
u just mentioned?
What is the meaning of -pi -e for perl?
【在 h******a 的大作中提到】![](/moin_static193/solenoid/img/up.png) : awk '!/^$/' urfile : perl -pi -e 's/^$//g' urfile : sed -ne '/^$/!p' urfile : if using tcsh/csh, be careful of using !
| h******a 发帖数: 198 | 4 csh/tcsh deemed harmful for programmers.
! has many special meanings in csh/tcsh.
if you try them in csh/tcsh, you will know
【在 o*******e 的大作中提到】![](/moin_static193/solenoid/img/up.png) : what shell do u use? : so awk/perl/sed should be shell independent? : BTW, what is the meaning of '$!' in awk : u just mentioned? : What is the meaning of -pi -e for perl?
|
|