learning how to script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers learning how to script
# 8  
Old 05-30-2007
To display the echoes of your "USAGE" function when the
number of parameters is not equal to 2 (two):
Code:
if [ ${#} -ne 2 ]; then
  USAGE
  exit
fi

# 9  
Old 06-05-2007
Thank you that worked great!

Now how about if I want to add to this script.

I want the script to also grab a number from a different report so:
cat different report | grep $2 | nawk -F, '{print $17}'

Then I would like the results to show up next to the first result. THEN I would like another column that shows the difference between the two numbers.

How can I do this?

THank you!
# 10  
Old 06-27-2007
hi just wondering if anyone had a chance to look at this and help me.

Thankyou
# 11  
Old 06-28-2007
Quote:
Originally Posted by llsmr777
hi just wondering if anyone had a chance to look at this and help me.

Thankyou
Can you show your input and output required?
# 12  
Old 06-28-2007
Thank you for the reply.

Here is my current script:

if [ ${#} -ne 2 ]; then
echo "\nUSAGE: report_1.ksh < report_1 name> [ switch short name ] \
n"
exit
fi

cat $1 | grep $2 | nawk -F"," '{tmp+=$10} END {print tmp}'

This is what I want to add to the script:

cat report_2 | grep $2 | nawk -F, '{print $17}'

I also want to add the results from the orignial script plus the results from what I want to add to be in two seperate columns. Then I want a 3rd colum to show me the difference of the two columns.

Thank you for any help!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Learning to Script in Linux

Hello, I'm trying to branch out and learn Linux, but my comfort zone is PowerShell. I figure the best way to learn it is to do it so I moved my Plex Media Server to Ubuntu Server. What I'm trying to do is build a script that searches a directory and all subdirectories for files with the .ts... (5 Replies)
Discussion started by: Rhysers
5 Replies

2. Programming

Learning python, lost with script

Hi there, im just having a hard time understanding why this code does not print anything that is suppose to print: score = raw_input ('what is your score? \n') try: if 1.0 == float(score) >= 0.9: print "A" elif 0.9 > float(score) >= 0.8: ... (1 Reply)
Discussion started by: la2015
1 Replies

3. UNIX Desktop Questions & Answers

Unix shell script learning

I am trying to learn Shell scripting in UNIX. Could Any one please suggest on how to get UNIX account or any other free stimulator available for download on which I can practice Unix shell script? Thanks, sam70 (9 Replies)
Discussion started by: sam70
9 Replies

4. Shell Programming and Scripting

Learning foreach

im newbie at shell scripting. why do the following code #!/bin/tcsh setenv CBC ~/cbc/models/ foreach mix (p00p00 p02p00 p02p04) echo $mix cp $CBC/*$mix*Gyr*fits $mix/ end print(copy) only the first mix? % ./copyfromcbc.sh p00p00 wasn't it supposed to run through all words... (0 Replies)
Discussion started by: prtc
0 Replies

5. UNIX for Dummies Questions & Answers

Learning Tips - UNIX Shell Script

Can any one please provide a fast learning tips to learn UNIX shell scripting? Thanks, Gov (3 Replies)
Discussion started by: Govindh.v
3 Replies

6. UNIX for Dummies Questions & Answers

Script Language Parser for Learning

I'm new to the UNIX world and have to learn scripting for my job. Presented with multiple scripts to learn (and then have to maintain in the future) is there a utility or process to input a script in it's native form and output what each line would look like fully parsed (i.e.: all variable names... (3 Replies)
Discussion started by: kcampb9
3 Replies

7. Shell Programming and Scripting

learning how to use shell script

hello everyone, i am still trying to get this script to work, but with no luck. It is a little beyond my knowledge of scripting at the moment. The beginner book i have has an exercise listed that asks me to write a script tha allows for user input. For example " what is your name: " and then you... (3 Replies)
Discussion started by: bebop1111116
3 Replies

8. UNIX for Dummies Questions & Answers

learning on my own

can i do this? i am learning this on my own..and from the book..simple unix i am not sure if the syntax would work if statement then statement do or for or while statement done else statement fi.... I dont know how else to explain that...I hope I... (2 Replies)
Discussion started by: jonas27
2 Replies

9. UNIX for Dummies Questions & Answers

Learning to script...want a project to work on (making a small MUD)

Will it be possible to make a MUD using unix script(bash)? I know I can easilly make a "dungeon" with different rooms I can run through and such(kinda like a maze game) . What I did was made a differnt shell script for each room and used CASE for the different places to go, ex. when you press N for... (2 Replies)
Discussion started by: learningtoscrip
2 Replies
Login or Register to Ask a Question