I'm trying the following loop to process a bunch of files and create a new filename for the output file, but it's not working. Also, I want to make the new value for TT to be five digits, with a leading zero.
Basically, I need to extract every 10 thousandth line from a bunch of input files. In each output file, I want to include a 5 digit line number in each output file's filename (so I know where it came from).
My current code just hangs (on further inspection, it created a whole bunch of strangely named files which I now must get rid of).
for ((TT=10000; TT<=100000; TT+=10000))
for fn in *U.csv;
echo head -n "$TT" "$fn" | tail -n 1 >"../$nfn"