05-11-2009
awk parameters check
Is there a way to preform check if the parameters that was send with the command awk -f `file_name.awk` `input_file` before even it gets to the BEGIN section (i have tested a try to check in the BEGIN it doesn't let ,you must make it on the section that after the BEGIN) and then decide if the script runs or not?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
How can I make an alias of an AWK one liner that prints specific lines from a file like below?
# from a command like this:
awk 'NR == 100, NR == 150' file.cfg
The alias I want to make should work like this(I guess):
<alias_command> <file.cfg><start_line><end_line>
So the... (1 Reply)
Discussion started by: majormark
1 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I have two solaris servers.
Please tell me what all parameters i can check to find out the difference between two servers.
how to differentiate based on H/W,S/W etc
like i have two servers
spdwa013 $ uname -an
SunOS spdwa013 5.8 Generic_117350-61 sun4u sparc SUNW,Sun-Fire-480R
... (1 Reply)
Discussion started by: usha rao
1 Replies
3. Shell Programming and Scripting
Hi,
The below script is working fine
awk1.sh
=======
awk BEGIN { FS="|" } FNR==NR { f1=$2; next } $1 in f1 && $2 =="xx" && $1 == "DAILY_JOB" {print $3}
awk -f awk1.sh a.txt b.txt--Its working fine .
When passing parameters its not working .Any help it should be appereciated.
... (4 Replies)
Discussion started by: akil
4 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a script that takes two parameters. I would check the script to run if these parameters are to null or come with the correct data.
If those parameters are to null, display a message, so if they come with two facts that are incorrect.
As you might see that?
Thx (1 Reply)
Discussion started by: pepeli30
1 Replies
5. Shell Programming and Scripting
$ ls
monkey.txt
banana.csv
tree.txt
$ myscript monkey.txt tree.txt
All extensions ARE alike.
$ myscript *txt
All extensions ARE alike.
$ myscript monkey.txt banana.csv
All extensions are NOT alike.
$ myscript *
All extensions are NOT alike.
My brain has given up; what's the simplest... (11 Replies)
Discussion started by: cs03dmj
11 Replies
6. Shell Programming and Scripting
Hello,
Would someone be able to tell me exactly how this command works please?
awk '!x++'
As usual any help much appreciated (8 Replies)
Discussion started by: Grueben
8 Replies
7. Shell Programming and Scripting
Hi
I have a script that reads a directory name, and then prints all de items in that directory. Now that works, but I want to check on the parameters to be sure that the user has write just 1 parameter, and if not, than the script closes. (7 Replies)
Discussion started by: hss
7 Replies
8. Shell Programming and Scripting
hi all,
i write a script in ksh but i have a problem
I want to check the number of parameters
while ]
do
echo "Inserisci la macchina che vuoi restorare o scrivi fine per terminare lo script, puoi restorare" $a "client: "
read CLIENT
echo $CLIENT
the variable... (1 Reply)
Discussion started by: FrancescoIt
1 Replies
9. Shell Programming and Scripting
hi, i got several pieces of code that look like:
for ff in `seq 3 $nlpN`;
do
npc1=`awk 'NR=='$ff' {print $1}' p_walls.raw`; echo ${npc1};
npc2=`awk 'NR=='$ff' {print $2}' p_walls.raw`;
npc3=`awk 'NR=='$ff' {print $3}' p_walls.raw`;
npRs=`awk 'NR=='$ff' {print $4}'... (10 Replies)
Discussion started by: calim_cfd
10 Replies
10. Shell Programming and Scripting
Hi,
I have 4 parameters passed to my shell and i validate if all four are entered using the following snippet:
if
then echo "Not entered"
else echo "entered"
fi
I get the following output as 'Not entered even when i enter the values for all prompts.
Please advise.
Thanks. (5 Replies)
Discussion started by: Jesshelle David
5 Replies