wc

2009-06-12 Thread Iram CHELLI
Hello, i am using wc in shell scripts the exact command is: wc FILE | cut -d -f 2 it usually works but sometimes wc outputs the result in a different formatting, that is, I have to do a cut -d -f 3 to get the wc. This is not very convenient that the wc program shall not return

Re: wc

2009-06-12 Thread iram chelli
Pádraig Brady a écrit : Iram CHELLI wrote: Hello, i am using wc in shell scripts the exact command is: wc FILE | cut -d -f 2 You probably want to squeeze adjacent blanks: wc FILE | tr -s '[:blank:]' ' ' | cut -d' ' -f2 cheers, Pádraig. Thank you this is great. Cheers, Iram

Re: wc

2009-06-12 Thread iram chelli
Bob Proulx a écrit : Iram CHELLI wrote: wc FILE | cut -d -f 2 it usually works but sometimes wc outputs the result in a different formatting, that is, I have to do a cut -d -f 3 to get the wc. The output format for the wc on different systems will produce a differing number

Re: wc

2009-06-12 Thread iram chelli
Pádraig Brady a écrit : Pádraig Brady wrote: You probably want to squeeze adjacent blanks: wc FILE | tr -s '[:blank:]' ' ' | cut -d' ' -f2 Note you might wonder why cut doesn't support -d'[:blank:]' to auto skip runs of horizontal whitespace. Details here: