@neil I was never really into sed & awk. Always preferred to use Python for tasks like this. But good to see how you solved it.
Discussion
@neil I was never really into sed & awk. Always preferred to use Python for tasks like this. But good to see how you solved it.
@neil In case your filenames ever contain spaces, tabs, or backslashes (any of which can mess up your while read loop), I recommend a different idiom:
while read -r; do rm -- "$REPLY"; done <both.txt
(The added -- is technically redundant here because the filenames come from find, so there is no chance of an initial - appearing in any filename.)
Alternatively:
xargs -d '\n' rm <both.txt
@neil Probably. I know that some people can do fantastic things using sed & awk. I never really felt the urge to do a deep dive and as I'm used to use Python for most of my tasks, this was always my tool of choice. But it's cool to solve these issues by using the tools that come with the OS.