Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-28-2005, 08:35 PM   #1
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
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:

awk -f assignment.awk -v clFlag="-n"
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!


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 01:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration