Hi Jack, On Dec 17, 2012, at 03:39, Jack Mc Lauren <jack.mclau...@yahoo.com> wrote: > How can I read a file which contains a number and assign that number to > a variable via awk programming? By the way, I want to use this awk program > in a shell script.
I'm actually not sure what you're asking, exactly -- you want the number to go into an awk variable? Or a shell variable? Assuming you want it to go into an awk variable, I would try something like this: getline my_number < filename; close filename; That assumes the filename is stored in the variable named "filename". It puts the number in the awk variable named "my_number". To put that in context, let's say you're getting the filename from $0, and you want to multiply the number by 2 and print it. You might do: filename = $0; getline my_number < filename; close filename; print my_number * 2; Or if I completely misinterpreted your question, let me know :-) ~Ben _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"