SED - Delete - Delete all lines of a file with N characters

sed -in '/^.\{9\}/d'

NOTE: May be impacted by the file encoding.

Ensure that the issued sed command is UTF-8 encoded

file filename should say UTF-8 Unicode text.

Alternatively, change your terminal and shell settings to UTF-8

printf à | wc -c must say 2, not 1.

locale should list “UTF-8” or “utf8” in the LC_CTYPE line.

iconv -f ^Ctin1 -t utf-8 filename | sed '/^.\{4\}/d' | iconv -f utf-8 -t latin1


sed -s -i -r '/^.{9}$/d' ./*.txt

Use AWK

awk -v n=5 '{ line = $0; gsub("[^[:graph:]]", "") } length >= 23 { print line }'

NOTE: Anything over 23 characters it will delete …you can change 23 to any value.