I made a for loop script as shown below,
for file in *.csv
do
grep raxA $file > new_${file}
done &&
mkdir raxA && mv new_* raxA &&
for file in *.csv
do
grep raxB $file > new_${file}
done &&
mkdir raxB && mv new_* raxB &&
for file in *.csv
do
grep raxC $file > new_${file}
done &&
mkdir raxC && mv new_* raxC
This script works when all the keywords found in the csv file, but it fails when any one of the keywords is missing from the csv files. Could you please help me to make this work, when grep specified keyword misses in the csv files. Thank you in advance.
&&
does and why the script fails due to it? – FelixJN Jan 07 '21 at 12:56