I'm dealing with a txt file that lists a bunch of other txt files, a lot of which I have wrongfully duplicated.
I'm on macOS so the lines listing the duplicated files all end with the pattern (NUMBER).txt. I want to delete all the lines that don't contain this pattern.
I came up with this command to test the regex but it does not work as it also prints the lines that end with (WORD).txt:
sed '/\(\d\)\.txt$|\(\d\d\)\.txt$|\(\d\d\d\)\.txt$/p' file.txt
I know I'm missing something but I can't figure out what... Thanks for your help!
\dnot supported, etc\dis not (traditional)sedregex syntax; instead it's just ad; did you try to read the sed manual page?