In bash I am running GnuPG to decrypt some files and I would like the output to be redirected to a file having the same name, but a different extension. Basically, if my file is named
file1.sc.xz.gpg
the file which comes out after running the GnuPG tool I would like to be stored inside another file called
file1.sc.xz
I am currently trying
find . -type f | parallel "gpg {} > {}.sc.xz"
but this results in a file called file1.sc.xz.gpg.sc.xz. How can I do this?
Later edit: I would like to do this inside one single bash command, without knowing the filename in advance.
If file names are guaranteed not to contain \n:
If file names may contain \n:
Note that opposite shell variables GNU Parallel's substitution strings should not be quoted. This will not create the file 12", but instead 12\" (which is wrong):
These will all do the right thing: