sed:delete:delete_all_lines_of_a_file_with_n_characters
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.
sed/delete/delete_all_lines_of_a_file_with_n_characters.txt · Last modified: 2020/08/16 13:59 by 192.168.1.1