Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2012 08:16:26 -0800
From:      Devin Teske <devin.teske@fisglobal.com>
To:        Jack Mc Lauren <jack.mclauren@yahoo.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: using AWK
Message-ID:  <18B0C79B-AF04-48D1-AF26-1B8A8B3641C1@fisglobal.com>
In-Reply-To: <1355744359.61103.YahooMailNeo@web160104.mail.bf1.yahoo.com>
References:  <1355744359.61103.YahooMailNeo@web160104.mail.bf1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

> Hi guys
>=20
> 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 i=
n a shell script.
>=20
> Thanks in advance

Try this:

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

--=20
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18B0C79B-AF04-48D1-AF26-1B8A8B3641C1>