Use read line to iterate over variables
3
I have the following files: $ ls *.png | egrep -i "am|pm" output-0 11.42.30 AM.png output-0 5.10.12 PM.png .... I want to remove them but get this error: $ ls *.png | egrep -i "am|pm" | while read line; do rm "$line"; done rm: cannot remove ''$'33''[0m'$'33''[01;35moutput-0 11.42.30 AM.png'$'33''[0m': No such file or directory rm: cannot remove ''$'33''[01;35moutput-0 5.10.12 PM.png'$'33''[0m': No such file or directory rm: cannot remove ''$'33''[01;35moutput-1 11.42.30 AM.png'$'33''[0m': No such file or directory What's the problem with my codes?
command-line bash ls
...