How to delete all lines containing more than a certain number of letters?
bash
Solution
$ awk 'length<=5' input.txt
bear
tree
Problem
How can I delete all of the lines in a file which contain more than a given number of letters? E.g. ``` bear rabbit tree elephant ``` If I restrict it to words of 5 letters or less, the output would be: ``` bear tree ``` - The file contains various foreign characters, each of these should count as one letter. - Punctuation symbols also can count as one letter.