I would like to decrypt a bunch of very large files and use the decrypted version of each file as input to a Python script which will process its content. So, if I have a file named
file1.sc.xz.gpg
after running the GnuPG decryption tool the output should be stored in a file named
file1.sc.xz
inside the same directory and this file should be the input to the Python script which will process its contents. Ideally I would like to do this inside one single Bash command, but I couldn't find the right way to do it. What I tried is:
find test/ -type f | parallel 'f="{}"; g="${f%.*}"; gpg "$f" > "$g" | python iterating-over-tokens.py "$g" '
but is not working. Any other suggestions? Many thanks in advance.
Later edit: if I could send the decrypted file (*.sc.xz) content directly to the Python script as an argument, that would be even better.
Directly piped to Python:
Create decrypted file first:
You need to be able to decrypt without entering a pass phrase. If
gpg
asks for a pass phrase rungpg-agent
first.