LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-28-2005, 08:35 PM   #1
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Awk command-line arguments


I cant process command-line arguments in awk properly...

At first everything will work fine when I only have a
BEGIN { # stuff } section, but then when I add other sections (like
END { # stuff }) Awk tries to 'OPEN' and 'READ' my command-line arguments as files

I need to process the arguments, not have Awk open them!
 
Old 03-28-2005, 09:09 PM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Original Poster
Rep: Reputation: 30
Hmm... I got one way working (using -v var="--my-program-option"), not quite what I was looking for, but it works!

Now when I run my script at the command line it looks like:

Code:
awk -f assignment.awk -v clFlag="-n" inventory.data
again, weirder than what I thought, but I guess Awk has to know whether somethings a file or an argument. Once again I answered my own question

I just hope thats the last one I have before this things due at midnight! yikes!
 
  


Reply


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
alsamixer command line arguments dereko Debian 3 09-29-2008 02:06 PM
Accessing command line arguments from a library function? tojo2 Programming 3 05-25-2005 03:56 PM
number of command line arguments to shell u4u Linux - General 1 03-04-2005 06:09 PM
Help with command line arguments ? synapse Linux - Newbie 2 02-23-2004 02:25 AM
Command line arguments to java program Majjj Programming 3 10-23-2003 05:48 AM


All times are GMT -5. The time now is 10:21 AM.

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