![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script Language Parser for Learning | kcampb9 | UNIX for Dummies Questions & Answers | 3 | 03-30-2008 02:21 PM |
| learning how to use shell script | bebop1111116 | Shell Programming and Scripting | 3 | 09-18-2006 11:18 AM |
| learning on my own | jonas27 | UNIX for Dummies Questions & Answers | 2 | 12-03-2001 08:29 PM |
| Learning to script...want a project to work on (making a small MUD) | learningtoscrip | UNIX for Dummies Questions & Answers | 2 | 10-24-2001 01:15 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
learning how to script
I have this command line entry that I would like to turn into a script. I want to be able to just run the script with options for the report name and switch. Can anyone help me get started? I am hoping that by creating this script it will help me be able to create more.
I have never written one. I have read a few websites but can't find a really good one yet so if you know of any taht'd be great too. Here is the command: cat report.20060222 |grep Detroit | nawk -F"," '{tmp+=$10} END {print tmp}' I want to just call the script total_rawfile.ksh Then be able to run: total_rawfile.ksh report.20060222 Detroit Thank you in advance for any help! |
|
||||
|
I am so dumb!
Ok now it works. How can I put a line so that if someone types the script name it gives it it's usage. I tried this but it didnt' work: function USAGE { echo "\nUSAGE: total_rawfile.ksh <report name> <switch short ID> \n" echo "Here is an example:\n" echo "total_rawfile.ksh RA_FW_SL4_rawfile_report.20070520.chk_SCOUT_ARCHIVE ANAJAL\n" } cat $1 | grep $2 | nawk -F"," '{tmp+=$10} END {print tmp}' #grep $2 #nawk -F"," '{tmp+=$10} END {print tmp}' Also let's say the variable has a / so like $1 is reports/daily is there anything special needed because the variable has a / in it? thanks for the replies. And patience! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|