I need to write a script to count the number of tabs in each line of a file and print the output to a text file (e.g., output.txt).
How do I do this?
Advertisement
Answer
awk '{print gsub(/t/,"")}' inputfile > output.txt
I need to write a script to count the number of tabs in each line of a file and print the output to a text file (e.g., output.txt).
How do I do this?
awk '{print gsub(/t/,"")}' inputfile > output.txt