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
 
 [.,\/#!$%\^&\*;:{}=\-_`~()]
 
This regex matches lots of punctuation. The following regex purports to match all punct.
 
/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/ 

 

Comments

Popular Posts