I have tried doing:
echo " mv /server/today/logfile1 /nfs/logs/ && gzip /nfs/logs/logfile1" | sed 's|logfile1|logfile2|g'
It printed:
mv /server/today/logfile2 /nfs/logs/ && gzip /nfs/logs/logfile2
which is a bash command. How can I make it get executed, instead of just printing it?
/server/today/
, and that you would like to move and gzip all of them? If so, I will suggest a simpler / safer solution.