I do have a small requirement of a bash script which will copy part of the line from a file and then append it to another file with some extra text (which contains another variable).
Example
File1.txt content
Warning: pasting the following URL into your browser exposes the OTP secret to Google:
https://www.google.com/chartxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Your new secret key is: xxxxxxxxxxxxxxxxxxxxxx
Your verification code is xxxxxx
Your emergency scratch codes are:
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
So I need to copy only the secret code and then paste it to another file
File2.txt
secret code of user xxxxxxxxxxx is saved
I'm new to Linux as well as scripting so any help on this would be greatly appreciated.
Also, please let me know if my query is not clear.