From owner-freebsd-questions@FreeBSD.ORG Mon Dec 17 16:16:32 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF3E0EC for ; Mon, 17 Dec 2012 16:16:32 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 564D98FC0C for ; Mon, 17 Dec 2012 16:16:31 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.31]) by ltcfislmsgpa01.fnfis.com (8.14.5/8.14.5) with ESMTP id qBHGGP4s004534 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 17 Dec 2012 10:16:31 -0600 Received: from [10.0.0.102] (10.14.152.61) by smtp.fisglobal.com (10.132.206.31) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 17 Dec 2012 10:16:26 -0600 Subject: Re: using AWK MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset="us-ascii" From: Devin Teske In-Reply-To: <1355744359.61103.YahooMailNeo@web160104.mail.bf1.yahoo.com> Date: Mon, 17 Dec 2012 08:16:26 -0800 Content-Transfer-Encoding: quoted-printable Message-ID: <18B0C79B-AF04-48D1-AF26-1B8A8B3641C1@fisglobal.com> References: <1355744359.61103.YahooMailNeo@web160104.mail.bf1.yahoo.com> To: Jack Mc Lauren X-Mailer: Apple Mail (2.1283) X-Originating-IP: [10.14.152.61] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8327, 1.0.431, 0.0.0000 definitions=2012-12-17_03:2012-12-17,2012-12-17,1970-01-01 signatures=0 Cc: FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 16:16:32 -0000 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