To pool specific content from a batch of files, I do
for ID in {92..128}; do
sed '3q;d' directory_$ID/stats
done
Now what if want to put the $ID
in front of each line read (preferably shifting the columns in a fixed-width manner) and then append the line to a report.txt file (creating it if it doesn't exist). I did some research on this but there seem to be many potential ways of doing it, none of which I'm familiar with as a new Linux user (perhaps I should just use Python next time).