awk script to find the number of characters words and lines in a file


AWK: The awk is similar to sed it can be used for to edit the file.

NF: The NF can be used to count the number of fields on a records.

NR: The NR can be used to count the number of records on a file.

Mv:The mv command is used to move the data from one file to another file.

Syntax: mv file1 file2

					BEGIN{print "record.\t characters \t words"} 
#BODY section 



total_len =len 


 words =NF 



 print("\n total") 

print("characters :\t" total len) 

print("lines :\t" NR)


Leave a Reply