Check These Out
inputfile.txt is a space-separated textfile, 1st column contains the items (id) I want to put into my SQL statement.
39 = charactercode for single tick '
$1 = first column
If inputfile.txt is a CSV-file separated by "," use FS= to define your own field-separator:
$ awk 'BEGIN {FS=","; }{printf "select * from table where id = %c%s%c;\n",39,$1,39; }' inputfile.txt
In order to write bash-scripts, I often do the task manually to see how it works. I type ### at the start of my session.
The function fetches the commands from the last occurrence of '###', excluding the function call. You could prefix this with a here-document to have a proper script-header.
Delete some lines, add a few variables and a loop, and you're ready to go.
This function could probably be much shorter...
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
These are way better than fortune(6).
shows which shared lib files are pointed to by the dynamic linker.
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
No need to install yet another program when openssl is already installed. :-)
This will catch most separators in the section of the email:
dot .
dash -
underscore _
plus + (added for gmail)
... and the basic dash '-' of host names.