I have a text file (st15.txt) containing many station ids.
st15.txt:
033445
234567
012345
222345
.
.
.
And, I want to match each station number to individual files in a directory, and then
I would like to copy that file into a different folder if any station id matches to a file.
For example,
"ls *.DAT" shows all files in the current directory.
Q012345.DAT
Q033445.DAT
Q123456.DAT
Q222345.DAT
X234567.DAT
X345678.DAT
.
.
If you look at "st15.txt", ONLY 4 stations are matching the files in the current directory. Thus,
033445 matches Q033445.DAT
234567 matches X234567.DAT
012345 matches Q012345.DAT
222345 matches Q222345.DAT
So, all these 4 *.DAT files should be copied into a new directory.
I think that awk would be the solution, but I don't know how to attack this problem.
Thanks,