UNIX Command Example: wc - Word Count Content of File or Result Set

UNIX Command Example: wc - Word Count Content of File or Result Set

Logon to UNIX command prompt then copy & past the bellow code to get some interesting result:

   wc -l country.txt
   wc -l country.txt | awk '{print $1}'
   wc -l country.txt | awk '{print $2}'
   Here "wc" is the command to Display Word Count of content of a file or result set.
   "wc -l country.txt" count lines of the file "country.txt".
   "country.txt" is the file holding country list of the world.
   "| awk '{print $1}'" Display only line portion.
   "| awk '{print $2}'" Display file only portion.
   If everything went well we should get some interesting result as follows:

UNIX Command Example: wc - Word Count Content of File or Result Set - Result in the UNIX command prompt

No comments:

Post a Comment

leave your comments here..