Issue
I would like to know a bash command that removes all lines from a file for which one of the following is true: - only digits AND equal to or shorter than 10 characters - only lowercase letters (a-z, no special ones like umlaut) AND equal to or shorter than 8 characters
I figured out that sed is the right tool for this, but I can't get the right syntax together.
Solution
Use grep
:
grep -vE '^[[:digit]]{1,10}$|^[[:lower:]]{1,8}$' file
Or sed
with same regexes:
sed -E '/^[[:digit:]]{1,10}$/d;/^[[:lower:]]{1,8}$/d' file
Answered By - codeforester