Delete single character rows in a text file

awk, command-line, linux, sed

Solution

Here is a try:

awk 'length>1' file

and if you do not want to delete blank lines (with zero characters)

awk 'length!=1' file

And if you have spaces on the lines (that you do not want to count as characters):

awk '{gsub(/[[:space:]]/,"")}length!=1' file

Problem

I have a text file with about 8 million rows in it. I need to remove all the rows with a single character in them. For example ``` This is the text file I wrote ``` I want to remove the entire line that has the pronoun "I" on it. Bonus points to the one who can do this on the linux command line.

Original source