CAT, AWK, SED

 

awk '{print $1}' file

will print first word in every line of file. 

 

I will probably put any and all discussions of using CAT AWK and SED on this page.

 

5) To count the lines in a file:  

$ awk 'END { print NR }' geeksforgeeks.txt 
 
  print any non empty line if present  $ awk 'NF < 0' geeksforgeeks.txt