I need to select files which contain "Error" or "traffic" in their names, e.g.
abc_ERRor.csv
raError.csv
bsn_Error.csv
bbbctraffic.csv
ccc_traffic.csv
...
and move them into corresponding directories like Error_directory and
traffic_directory according to their names.
I tried this but it didnt work
mv $(ls test_file | grep -l 'Error>' *) Error_directory
How can I do this with a bash command?
ls test_file | grep 'Error'

grepis irrelevant here. Start with the task, and then determine the tools, and try to avoid using Unix commands as verbs unless that is exactly what you mean. – jw013 Sep 14 '12 at 18:48