I have a line that will generate the md5sum into a file from files included:
find / -type f \( -name "*.pl" -o -name "*.py" \) | md5sum *.pl *.py >> sum.txt
The sum.txt will output:
d41d8cd98f00b204e9800998ecf8427e file.pl
60b725f10c9c85c70d97880dfe8191b3 file.py
I would need to include the server name after the file name, preferably reading $HOSTNAME as the script will run on different servers, as:
d41d8cd98f00b204e9800998ecf8427e file.pl host.one.com
60b725f10c9c85c70d97880dfe8191b3 file.py host.one.com
findportion is useless. You are throwing away its output andmd5sumis just running on the*.pland*.pyfiles in the current directory. If you want to operate on the output offindyou need to usexargsor-execor similar actually runmd5sumon the output of thefindcommand.sedorawkor similar to post-process the output file.findbit of the command isn't helping you at all. Try without it and you'll see. Alsomd5sum *.pl *.py | awk '{print $0, ENVIRON["HOSTNAME"]}' >> sum.txt.md5sum *.pl *.py | awk -v ORS=" $HOSTNAME\n" 1.