Les Mikesell wrote: > mark wrote: >> hadi motamedi wrote: >>> On Thu, Dec 3, 2009 at 12:42 PM, mark <m.roth at 5-cent.us> wrote: >>>> John Doe wrote: >>>>> From: hadi motamedi <motamedi24 at gmail.com> >>>>>> Can you please do me favor and let me know if I can go further and try >>>> for >>>>>> advanced search like finding how many rows inside a file have data that >>>>>> does not start with a zero after the third comma ? >>>>> Something like: awk -F, ' { print $4 } ' | grep -v "^0" | wc -l Use one >>>>> command at a time to see how they work with each other (you might have to >>>>> modify the grep a bit)... >>>> *sigh* >>>> >>>> Drive me crazy, why use multiple commands? >>>> >>>> awk -F 'BEGIN { FS = ","; }{if ( $3 !~ /^0 ) { count++; }} END { print >>>> count }' >>>> filename >>> Sorry . I tried for your proposed procedure , as the followings : >>> #awk -F 'BEGIN { FS = ","; }{if ( $3 !~ /^0 ) { count++; }} END { print >>> count }' HLRSubscriber-20091111173349.csv >>> But my CentOS server didn't return to the prompt . Can you please let me >>> know why it is in an end-less iterated loop ? >>> Thank you in advance >> Syntax error. You wrote >> if ( $3 !~ /^0 >> not >> if ( $3 !~ /^0/ >> >> PLEASE: if you ask for help, and someone gives you examples, READ THE MAN PAGES >> SO THAT YOU KNOW WHAT YOU'RE DOING. I could have just as well have given you >> something that would have wiped your system (like system("rm -rf /"). > > Awk is just too weird for normal people. I wouldn't even suggest reading that > manual. If you can't do what you want with regexps and a pipeline of simpler > programs, you might as well use perl. <Looks around, yeah, this *is* a list for sysadmins of Linux....> ROTFLMAO! > > But: > grep -v '^.*,.*,.*,0' filename |wc -l > seems simple enough and says what you mean. > > Or: > cut -d, -f4 | grep -v '^0' |wc -l > So, is there an obfuscated shell contest? mark -- America was *not* built by "rugged individualists". - whitroth "We must all hang together, or we shall all hang separately" - B. Franklin