![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No space on /dev/hd 1/42 | ibqti | SCO | 1 | 11-09-2007 01:53 PM |
| swap space / paging space | aaronh | AIX | 2 | 05-19-2004 07:06 AM |
| how much space? | pgas | UNIX for Dummies Questions & Answers | 1 | 04-06-2004 08:03 AM |
| pageing space vs swap space | VeroL | UNIX for Dummies Questions & Answers | 1 | 01-22-2004 07:54 AM |
| More space | grep | UNIX for Dummies Questions & Answers | 2 | 12-02-2002 11:08 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Pb with space wc -l
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 space on output without change code. thanks for your help. $ cat profile.ksh | wc -l 91 |
| Forum Sponsor | ||
|
|
|
|||
|
Echoing a variable or other expression without quoting it will remove any leading and trailing whitespace.
Code:
echo `wc -l <profile.ksh` Note the use of redirection to avoid the Useless Use of Cat. Are you sure about the AIX spacing issue, though? The situation where you usually see this is when you use wc -l file instead of wc -l <file (but then of course you get the file name also). |
|
|||
|
Hi, thanks you for your response.
Yes, i have this space on AIX, and not on HP-UX. I don't know why ? right, with echoing , i don't have space , and with a sed too ( cat profile.ksh | wc -l | sed 's/ //g) do you know how i can realise this change with an alias or function, in order to not change code ?? ( i have many shell scripts) (wc -l profile.ksh | perl -ne 's/(.)/ord($1)/eg;print' 32323232323256523211211411110210510810146107115104) 32 are space. Thanks in advance |
|
|||
|
Changing it with a function sounds perilous, but I suppose it could be done.
Code:
wc () {
/usr/bin/wc "$@" | sed 's/ //g'
}
Code:
case `uname -s` in
AIX) wc=/tru/blu/wc;;
HP-UX) wc=/ick/opt/we/are/weird;;
esac
wc () {
$wc "$@" | sed 's/ //g'
}
|