how to pipe/redirect awk output into a variable?
Hi.
I have a simple awk command to read the number of records in a file which is passed to it. I'd like to then save this output as a variable within a bash script. How is this done? The pipe I use below doesn't work.
awk '{ ++x } END { print x }' file_name | read my_variable
Similarly I get an error when I try:
read my_variable < awk '{ ++x } END { print x }' file_name
Thanks.
|