To pool specific content from a batch of files, I dofor ID in {92..128}; do     sed '3q;d' directory_$ID/statsdoneNow 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).
Read line from file, manipulate, and then append to another file
shell script;sed
To append $ID (with space) at the beginning of each line something likesed s/^/$ID /should work (notice double, not single quotes). If you want to do this within the given loop and redirect output to report.txt tryfor ID in {92..128}; do     sed s/^/$ID /;3q;d directory_$ID/statsdone > report.txt