I am using two files - one file contains list of service name , other file contains commands for each of these service name .
I have to read each service name and check this string in 1.cfg file , if it exists , then i have to read another file (commands file ) and take the string and check if it is in 2.cfg file . i have to continue till end of the line in the files.
Note : it should be one after the another .
I wrote a script which is has below
here the inner for loop executes completly first , checks all commands and then goes to outer for loop . but my requirement is to check service then check command . and it should repeat like check service and then command.
Please help
Thanks
Last edited by Scrutinizer; 01-21-2016 at 02:47 PM..
Reason: code tags
Not clear. Your snippet loops through the entire command file once for EACH service entry. Regardless of the service's existence in file1. Which might become lengthy.
Please be way more detailed and specific - what exactly do you want to achieve? What's the relation between services and commands? Do you know about the -f option to grep?
here are the details :
example
my service file list is as below
for each service , my command list file is having corresponding command entry as below
i have to write a validation script to which
a. read service file list (one by one ), check that in 1.cfg file then
b. read command file list ( one by one ) , check that in 2.cfg if it exists.
Repeat a and b step for each time.
hope this time my requirement is clear.
Thanks in advance.
Moderator's Comments:
Please use CODE tags as required by forum rules.
Last edited by Don Cragun; 01-21-2016 at 07:18 PM..
Reason: Add CODE tags.
Using shell scripting, implement ‘scan.sh' that scans the file system recursively starting
from current working directory and generates the file ‘index.txt' that contains a line for each
file (or directory) with following fields in tab separated format:
1. The full path of the directory... (1 Reply)
Hi iam new to shell programming. I would like to ask one dought abt the file
handling in unix.
Iam having a file1 as follows:
ASDERFCX1234567890123456
POIUYTRE0098765432123456
BVCXCVBN0955644411111111
File2
ASDERFCX1234567890123456 kill@abc.com ... (8 Replies)
Hi,
Iam new to shell program,
I want to check a file which is having same lines 2 times and i want to display it in a seperate file.
File format is :
AQWERTYU|1234567890
ASDFGHJK|0987654321
ZXCVBNML|1098576453
AQWERTYU|1234567890
I need to take the 1st and 4th lines in the above... (5 Replies)
Could someone please tell me what {} mean when they surround a variable?
For instance,
$FILE = 'basename $1' //what is passed into this script
$BANK = 'dirname $1'
$INFILE = ${FILE}.${BANK}.$$
What does $INFILE contain after this assignment?
Please let me know
Thanks
G (4 Replies)
For what purposes should we use shell
/what are the tasks we can achieve using shell
which is best book to learn shell programming
and will nayone tell me diff between shell programming aand shell scripting?
Thank u in advance. (1 Reply)
Hi,
I am new to shell programming, and hve been given a request to write a shell script.
Is there any good places to go to see examples of how to write shell programming scripts?
Thanks (4 Replies)
I have a fix_table.ksh script that takes a TABLENAME and a date.
So, in jk_table_file.txt I have the tables...one per line, and
in jk_out_file.txt I have the date in the format I need.
The following doesn not 'want' to work in a shell script...
for TABLE in `cat jk_table_file.txt`; do
... (2 Replies)