On Dec 17, 2012, at 3:39 AM, Jack Mc Lauren wrote:

> Hi guys
> 
> 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.
> 
> Thanks in advance

Try this:

awk -v file=/etc/ttys 'BEGIN { getline line <file; printf "First line from %s: 
%s\n", file, line }'

-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to