Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-06-2007, 09:02 AM   #1
LQ Newbie
Registered: Dec 2007
Posts: 1

Rep: Reputation: 0
awk question about BEGIN patttern

I have a awk script with the following BEGIN pattern

BEGIN { upper = "PNBRQK"
lower = "pnbrqk"
getline < "lance1.tmp"
cor = substr($0,77,1)

I ca use cor inside other patterns when I run the script over lance1.tmp but I woul like to use it when I run the script over other files. How can I do that.

Thanks in advance for any help

Old 12-06-2007, 06:40 PM   #2
Registered: Feb 2005
Distribution: Ubuntu, CentOS
Posts: 585

Rep: Reputation: 35

awk -f your-script.awk name-of-file-to-process

BEGIN { upper = "PNBRQK"
lower = "pnbrqk"
getline < ARGV[1]
cor = substr($0,77,1)

ARGV[0] contains "awk"

Use ARGC to see that you have two parameters, one for "awk" and one for your file name.


awk, begin

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
an awk question zoshr Programming 5 04-13-2007 06:29 AM
awk question davidkline Linux - General 9 09-29-2006 01:37 PM
Awk question blanny Linux - Software 6 05-02-2006 09:03 AM
AWK question paraiso Linux - Newbie 5 05-12-2005 02:37 PM
awk question jonlake Linux - Software 2 05-04-2005 04:58 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration