I currently have a for loop in bash as such:
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
do
touch $i.txt
awk '{if ($2 == "$i") print $1;}' results.txt > $i.txt
done
What I want it to do is take the time (stored in column 2 of results.txt), create a file and then print out column one (from results) into the new file. When I do this manually (just for one instance, say i = 01) it works fine, but as soon as I try to loop it, all the files are empty? Can someone help me understand what's happening?
Thanks!