Published: Nov 05 2012 / 07:45
#> cat TEXTFILE | grep -v '^[[:blank:]]*$' | wc -l
Hi Nikolas, Your command would escape the empty lines, but it will fail in the below scenario: 1.Make a file with 2 records one on each line Example: name.dat Rafael (press Enter) Zin (dont press Enter) 2. After the data in 2nd line dont press enter. As discussed above. 3. Now run your command you will get wrong output.
Nope. After fixing all the typos in your script ('gerp' vs 'grep' and a few missing backticks) it returns the same result.
And another typo: "$nl_coun2" vs "$nl_count2"
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.
Advertising - Terms of Service - Privacy - © 1997-2014, DZone, Inc.