Assume I have this command: ./clang-$j.out >> clang-result.txt and the each output for clang-$j.out is a fixed-length hash value (each program per line), however, I want to distinguish them by adding a prefix to the beginning of each line. For example, I want to add 1- where is number comes from the variable j.I've made some effort to do this but I still cannot figure out how to do.
Add some text while output to file
bash;shell script;scripting
You can output the number from the variable before running each program; in your loop:printf %s- ${j} >> clang-result.txt./clang-$j.out >> clang-result.txt