Script tool


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script tool
# 1  
Old 10-31-2003
Script tool

Hello,

I am new to korn shell scripting and I would appreciated if someone can help me get started with the following:

I have a text(registry) file which looks like:

1 SOFTWARE 0
4 Clusters 0
0 Application Server 0
0 BasePath 1 /home/new/sso
0 AppPath 1 /home/new/ddd/eso/APPS

and many more.

Here is what i need to do:
1) The first parameter of the script takes the Keyname(second column such as BasePath) as argument.


2) The second parameter of the script should be denote the value of the Key you want returned back to the console. For example, in the following key, if you pass in 4, "/home/new/sso" should be returned to the console.
example: 0 BasePath 1 /home/new/sso

any help with this script will be much appreciated
# 2  
Old 10-31-2003
Try this in a script and see if it works for you: Smilie

grep "$1" someFile | cut -f$2 -d" "
# 3  
Old 10-31-2003
oombera thank you very much for your reply. Could you please tell me how this statament works?

Also, some of the rows in the file have invalid entries for the 1st and 2nd parameters such as:

1 GUID 1 {934948494-E768-11D0-8BB0-000A0280D1944}
0 CONN 0 (null)


so i need to check for each parameter to make sure are valid.


once again Thank you very much.

Last edited by yotoruja; 10-31-2003 at 03:09 AM..
# 4  
Old 10-31-2003
Well, it does what you requested in the first post. Put that line in your script file and then when you call your script file, use something like:

nameOfYourFile BasePath 4

and you'll get returned /home/new/sso

As far as validation, what do you want to check for? How do you determine what's invalid and what's valid? (Not in code, just tell me in plain english what you consider valid and not valid.)
# 5  
Old 10-31-2003
Quote:
As far as validation, what do you want to check for? How do you determine what's invalid and what's valid? (Not in code, just tell me in plain english what you consider valid and not valid.)


1) for the first parameter the following line:

0 GUID {A84F050...526480000} Module GDS Basic

is invalid since GUID is not a Keyname everything else is valid.


2) for the second parameter the following line:

0 MsgDBPath 1

if I pass in 4 it will error out since there isn't anything to return.


thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help updating my AIX shell script that uses IBM tape tool.

I have a shell script that interfaces with our tape library using IBM's Tape Diagnostic tool called "itdt". The script does some basic stuff, it queries the tape library, loads tape to/from drive; it knows which inventory slot to pick the tape from based on SLOT=$(($BASESLOT + $TODAY)). The... (10 Replies)
Discussion started by: c3rb3rus
10 Replies

2. Shell Programming and Scripting

Shell script executed from Informatica ETL tool is spawning 2 processes for one script

Hi, I am having a shell script which has a while loop as shown below. while do sleep 60 done I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Discussion started by: chekusi
2 Replies

3. Shell Programming and Scripting

help me for Perl script for tool usages

Hi, How to do Perl script for floating license usages metric. Anyone help me out this issue? Regards, Ram. (0 Replies)
Discussion started by: ramanthan
0 Replies

4. Shell Programming and Scripting

Giving automatic multiple Input to a tool from shell script

Hi, Please help me,its urgent. I have a tool that i want to run from a shell script. When we run the tool it will ask the user choice to add or delete. When user enter the choice it will then ask how many units he want to delete or add and will add or delete accordingly. Now I want to... (1 Reply)
Discussion started by: saket18@ymail.c
1 Replies

5. Shell Programming and Scripting

script for GUI tool

Hi Legends. Thanks for all your support till now, Now my requirement is planned to create a GUI backup tool for both "Source Code Backup" and "Mysql Backup" is it possible to write own code for this , or else any other opensource Backup tool is available which option is better? my wish is Write... (0 Replies)
Discussion started by: anishkumarv
0 Replies

6. Shell Programming and Scripting

script using expect tool

Hi All, I need ur help and suggestion to make my code efficient.I have to reset the password for multiple unix flavour using expect tool.There is one file in which I have mentioned ip address and main script will pickup those ip and reset all password and it will write to a log file whether it has... (1 Reply)
Discussion started by: manish_1678
1 Replies

7. Infrastructure Monitoring

need script for passwd , can't use expect tool

Hi , as others users here , i'm searching for a script which can automate "passwd" dialog . I saw threads about "expect tool" but on my platforms , "C" product isn't installed and i'm not the admin so i can't install it. is there another way to do it , with a "simple" shell script ??? ... (35 Replies)
Discussion started by: Nicol
35 Replies

8. Shell Programming and Scripting

Help with Expect tool Script

Problem Description: I have written the Expect script in Linux box, able to login from Linux to Windows and able to execute the command(eg, hostname) on windows server which produces some value. I want to pass this value from Windows to Linux box . Can we pass any parameter from Linux with expect... (2 Replies)
Discussion started by: khagendra
2 Replies

9. Web Development

Tool Tip on a Perl CGI script

Hi, I am writing a perl script using Perl CGI. There are various HTML tables and forms involved in this. Now I wanted to add a tool tip to the elements here but I am not able to find documentation on how to do it. Can anyone help? Thanks in advance. Regards, garric (5 Replies)
Discussion started by: garric
5 Replies

10. Shell Programming and Scripting

Log Rotation Tool/Script

Hello all Does anyone has an intersting script or a good freeware tool for log rotation that is good for Unix and Linux as well ? My thanks in advance (4 Replies)
Discussion started by: yelalouf
4 Replies
Login or Register to Ask a Question