How to create a shell script to read a foldername from a text file and go to the folder?
Hi,
I am trying to write a shell script which can read folder names from a text file and then go to the folder and picks up a xml file and write on my sipp script so that I can run the sipp script.
For example:
I have a text file called thelist.txt where I have provided all the folders name in which I have kept xml files for different purposes.
I want to write a shell script which can read the text file and then go to individual folders and picks up the xml file and write it into a sipp command.
It should be done 1000 times if I have 1000 names in the text files and I want to execute the script for 1000 xml files.
How to create a shell script to read a foldername from a text file and go to the folder?
Here is the code which is just reading the name from testlist.txt and I have given the absolute path of the directory where it should read the .xml from.
Now I have achived my first hurdle. I want to execute the scripts one by one and not parallel. currently its executing all the scripts in parallel.
Please suggest
My Code:
Last edited by DukeNuke2; 01-25-2013 at 07:02 AM..
Second, to run a command in the background, simply put an & at the end of it.
Third of all, unless your computer has 1000 cores, no point in running 1000 processes simultaneously, they will just go slower. You ought to wait after doing a certain number. Not all shells have facilities to wait for a particular process, the following script requires bash or newer ksh.
Last of all, if these processes are disk-intensive, running them in parallel may not make them faster anyway.
How to create a shell script to read a foldername from a text file and go to the folder?
Thanks a lot for suggesting me the good practices. I will make sure I take care of these good practices in my script.
What is the good way to execute one script at a time?
sipp command goes in text file "testlist.txt" and it reads one folder name and it goes in the folder and reads .xml file execute the script and writes the result in a result file and then jump to the next script.
Is it possible to create new folder and write a new text file in the folder while the current position is outside the new folder? in one line
mkdir folder | echo "hello test"> folder/test.txt
not work. (1 Reply)
i have a text file as belows, it includes 2 columns, 1st is the column name, 2nd is the file_name
data_file.txt
column_name file_name
col1 file1
col2 file2
col3 file1
col4 file1
col5 file2
now, i would like to... (4 Replies)
I have a script that sorts and processes unsorted files to newly created directories.
Its working great, but I am trying to understand the leanest method to get the script to create an additional file within each newly created directory that:
Contains a list of all files in the directory... (4 Replies)
Have to read one file say sourcefile containing several words and having another folder containing several files.
Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Hi ,
I am trying to write an shell, which reads a text file (from a location) having a list of numbers of strictly 5 digits only ex: 33144
Now my script will check :
1) that each entry is only 5 digits & numeric only, no alphabets, & its not empty.
2)then it executes a shell script called... (8 Replies)
The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
I am having one text file and i need to read that data from my shell script.
I will expain you the scenario:
Script look like:
For name type 1:
For age type 2:
For Salary type3:
echo "Enter the input:"
read the data
if input is 1 then go to the Text file and print the... (2 Replies)
hi all,
I have this file with some user data.
example:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Hi....can you guys help me out in this script??
Below is a portion text file and it contains these:
GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001... (1 Reply)