Thursday, 9 December 2010

Display execution data inside awk command

The easiest way to use output from, i.e, a command inside awk, is capturing the output and assign it to a variable. For example, if we need to print the current date, we can use:

awk -v D=$(date +%Y%m%d-%H%M) '{print D "-"$12}'

Obviously, you've to customize it according your needs.

No comments:

Post a Comment