Artificial intelligent assistant

Remove lines in a shell script I have this file: # more file.txt 2c2 lns-ld-wall-01-t2 old:261,260 4c4 Prive_ORANGE old:258,259 I need to remove all lines like this one `2c2` and this one `4c4`. How can I do in a shell script?

This should work:


sed 's/.*[0-9]c[0-9].*//g' file.txt


However as mentioned in the comment, above command will not remove the complete lines, so a better way would be to use the `d` command on matching lines instead:


sed '/[0-9]c[0-9]/d' file.txt


Or with extended regular expressions with GNU `sed` (`-E` is the preferred flag for compatibility with BSD* `sed`s):


sed -E '/^[[:blank:]]*[0-9]+[a-z]+[0-9]/d' file

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7d8101454afead4b4f4f592ecc16c446