My file, aaa,has 5 lines.
01_AAA-11-ID22
02_BBB-33-ID44
03_CCC-55-ID66
.
.
I tried to grep anything after underline from a file bigfile.txt
for i in $(cat aaa)
do
A= $(awk -F '_' '{print $1}' $i)
B= $(awk -F '_' '{print $2}' $i)
grep $B bigfile.txt > $A
done
I tried to do
grep AAA-11-22 bigfile.txt > 01
But, it seems not working. My error code is
awk: cmd. line:1: fatal: cannot open file `01_AAA-11-22' for reading (No such file or directory)
Need some advise. Thanks,