02-02-2012
Quote:
Originally Posted by
heaven25
Ty Corona for your answer, but I know the -v option.
Unfortunately, i need to do like what i wrote before, sure it is very easy but i dont find the way..
awk doesn't work that way. Giving awk an argument of '10' tells it to open a file named '10'. Positional parameters are arguments or filenames, period.
If ARGV[1] doesn't work in your awk, then your awk doesn't have ARGV.
Why do you need this? Couldn't you make a simple wrapper script to do this for you, converting shell arguments into a -v argument, instead of cramming arguments where they don't belong on awk's commandline?
10 More Discussions You Might Find Interesting
1. Programming
I searched on the forums. No advises.
I am using a previous source code. I changed the main function main(int argc, char **argv) in a function misc(int argc, char **argv). How do you use the argc and argv parameters? This is how I am calling the function :
char param;
strcat(param,"wgrib ");... (4 Replies)
Discussion started by: Akeson Chihiro
4 Replies
2. UNIX for Dummies Questions & Answers
hello
does anyone knows how can i reach a parameter in awk command line
for example
p1 f 4
p1 is an awk script. 4 is parameter
i want to work with the second parameter
i know it has something to do with argv command
i just dont know the syntax.
please help. (1 Reply)
Discussion started by: emil2006
1 Replies
3. Programming
Is it possible to use the dbx debugger with the CL options for the executable ?
Say you have created a executable called myfunc which can take string arguments at run-time. You run it like this
./myfunc Hello World
where Hello and World are the string arguments
My question is whether... (1 Reply)
Discussion started by: JamesGoh
1 Replies
4. Programming
Hi C experts,
I have the following code for adding command line option for a program
int main (argc, argv)
int argc;
char *argv;
{
char *mem_type; //memory type
char *name; //name of the memory
int addr; //address bits
int data; ... (5 Replies)
Discussion started by: return_user
5 Replies
5. Shell Programming and Scripting
mode=$1
psg telnetd | awk current=`date +%M`'{
printf ("mode is %s",mode)
printf ("mode is %s",ARGV)
}'
at command prompt when i run the script along with the argument i get only--
'mode is '
argument is not printed.(If the argument is... (3 Replies)
Discussion started by: Anteus
3 Replies
6. Programming
Hello All,
First post. I've been struggling with the following:
Given a char* string, I need to construct an "int argc, char *argv" style structure. What I'm struggling with most is handling escaped-whitespace and quotes.
e.g. the string:
char *s = "hello world 'my name is simon'... (10 Replies)
Discussion started by: cbarwise
10 Replies
7. Shell Programming and Scripting
Hi Folks,
I've prepared a shell script that takes action based on arguments and number of arguments..sample code like:
ARGV=("$@")
ARGC=("$#")
case ${ARGV} in
abc)
if ; then
......
else
printf "\nInvalid number of arguments, please check the inputs and... (2 Replies)
Discussion started by: SBC
2 Replies
8. Shell Programming and Scripting
I have written this code in an awk script.
BEGIN {
print "ARGV", ARGV
if ( match(ARGV,/-u/) || match(ARGV,/--usg/) ) {
print "MATCH -u:",match(ARGV,/-u/), RSTART, RLENGTH
print "MATCH --usg:",match(ARGV,/--usg/), RSTART, RLENGTH
usage()
exit(1)
}
}
I want... (7 Replies)
Discussion started by: kristinu
7 Replies
9. UNIX for Advanced & Expert Users
All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address).
I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
Discussion started by: alister
9 Replies
10. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
First, create a "hello world" program that prints "Hello World". But NOW, instead use argc to verify that a... (9 Replies)
Discussion started by: miniviking10
9 Replies