With this for loop which I execute directly in the shell, I am able to cat the contents of all files in a folder, with the value beside of it:
$ for f in *; do echo -e "\t"$f"\n"; cat $f; done
Example output:
100
testfile1
testfile3 <-No output because this file is empty
hello
testfile2
But I'd like to print the value on the right side and the file on the top left like this:
testfile1
100
testfile3
testfile2
hello
I tried to swap the position of echo and cat but that doesn't work, it works exactly as the other command.
$ for f in *; cat $f; do echo -e "\t"$f"\n"; done
How can I achieve this?