Hi,
I would like realize a script that it can change " wc -l" with "wc -l | sed 's/ //g'", but my problem is that i can have
a pipe ,a variable ( many variable different) or a file after wc -l ?how i could test this several case ?
wc -l | cut -d' ' -f1`
if [ `wc -l <$FILE` -ne 1 ]
wc -l ${F} | awk '{print $1 }'
Thank you for your help.
era
April 14, 2008, 1:02pm
2
I believe the function I posted earlier should work for all these cases.
Hi, i would work hp-ux script on an AIX, and i have a pb with wc -l command, on AIX this command made a space on output and hp not. And I would like use an alias or a function in order to remove this | The UNIX and Linux Forums
Because I don't have the space problem, I made a slightly different wc function for testing here.
vnix$ type -all wc
wc is /usr/bin/wc
vnix$ wc () {
> set -- `/usr/bin/wc "$@"`
> echo $1
> }
vnix$ wc /etc/motd
8
vnix$ wc -l /etc/motd
8
vnix$ /usr/bin/wc /etc/motd
8 50 338 /etc/motd
vnix$ wc -l </etc/motd | cut -d ' ' -f1
8
vnix$ if [ `wc -l </etc/motd` -eq 8 ] ; then echo foo ; fi
foo
vnix$ F=/etc/motd
vnix$ wc -l $F | awk '{ print $1 }'
8
Don't these cases work for you?