Hi,
Let's assume in a shell script we have an awk code that does processing of input, and after it has been processed inside AWK, I need to make that value accessible outside of AWK for further processing in the script.
Currently I'm using a temporary file to store that value to have it later available outside of AWK, which does the job, but I'm not too happy with that.
So I'd like to know if there is a more elegant, neater way of declaring that value outside of AWk, without using a temp file, but maybe using an AWK native tool which I'm not aware of ?
Example:
Thanks,
Let's assume in a shell script we have an awk code that does processing of input, and after it has been processed inside AWK, I need to make that value accessible outside of AWK for further processing in the script.
Currently I'm using a temporary file to store that value to have it later available outside of AWK, which does the job, but I'm not too happy with that.
So I'd like to know if there is a more elegant, neater way of declaring that value outside of AWk, without using a temp file, but maybe using an AWK native tool which I'm not aware of ?
Example:
Code:
#!/bin/sh
ls -l | awk 'NR==1{print $NF > "temp"}'
cat temp
....
further processing here of temp file....
...
rm temp
Thanks,