03-24-2008
trying to create a script to read a flie and loop a command...
I tried to explain this earlier, but did a poor job of it. So I am trying again but taking a different approach.....
I have a file called test_words. In this file I have one line with 5 three letter words, with a single space seperating the words.(I.e., "cat car mop red pin")
I want to create a script that will read the file and loop each word individually into a command until all words in the file have been used. Use the echo command for arguements sake.
the output would look like this:
cat
car
mop
red
pin
The file test_word may change, by adding words or subtracting words, but always use a space as the delimiter.
can anyone help with this?
Thank you in advance for any and all help on this.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi All,
I have one question to have a answer with your help.
i need to have a script for searching a file with .log extension form all directories. search for a word " Pass" in the files and to count the occurence of the word "Pass".
i need all your help to solve the problem.
Thanks,... (3 Replies)
Discussion started by: sipmohan
3 Replies
2. UNIX for Advanced & Expert Users
Tried to explain this earlier, but did a poor job of it. So I am trying again but taking a different approach.....
I have a file called test_words. In this file I have one line with 5 three letter words, with a single space seperating the words.(I.e., "dog car mop red pin")
I want to create a... (1 Reply)
Discussion started by: Italy87
1 Replies
3. Shell Programming and Scripting
Hi,
'read' command is not working inside the while loop, How can I solve this?
Rgds,
Sharif. (2 Replies)
Discussion started by: sharif
2 Replies
4. Shell Programming and Scripting
Hi,
does anybody knows how to manage, that the filenames are assigned to a variable in a loop afer getting them with set command in a ksh, like:
set B*.txt
i=1
c=$#
x=$((c+1))
echo "$x"
while ] ; do
_ftpfile$i="$"$i
echo "$_ftpfile$i"
i=$((i+1))
done
The first echo returns,... (2 Replies)
Discussion started by: spidermike
2 Replies
5. Shell Programming and Scripting
Hi ,
I have to create a db2 connection for the while loop in shell scripting.
Below is the connection for DB2 I have to establish
connect to TABLESCHENMA user $USERID using $PASSWORD
Below is the while loop.
while read TABLE; do
db2 LOAD CLIENT FROM
$DIRECTORY/$TABLE.ixf OF ixf INSERT... (1 Reply)
Discussion started by: vikyalex4
1 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I have a flat file as below;
470423495|1||TSA-A000073800||1|||1
471423495|1||TSA-A000073800||5|||5
472423495|1||TSA-A000073800||2|||7
473423495|1||TSA-A000073800||3|||3
I like to create a Unix script.
The script have to valuate the last two columns, if the values are... (4 Replies)
Discussion started by: mrreds
4 Replies
7. Shell Programming and Scripting
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... (7 Replies)
Discussion started by: pm1504
7 Replies
8. Shell Programming and Scripting
My question is how would i loop a read command to keep asking the user for input and eventually print the no. of valid invalid inputs after a specified control input typed i.e. (-3). (1 Reply)
Discussion started by: Flowoftruth
1 Replies
9. Shell Programming and Scripting
Hi all. I need a shell script that can, in short, read through a text file line by line and create a new user in Ubuntu, as well as assign that user to a group. The format of the text file is not important but preferably: 'username:group'. I don't have much programming knowledge no matter shell... (3 Replies)
Discussion started by: LewisWeekly
3 Replies
10. Shell Programming and Scripting
Hello Experts,
I have created one user confirmation process that will ask for user input. I have created one func for it. The issue is if i call it as normal then it works fine but if i am calling it in another script(in while loop) . It is going in infinite loop and not asking for user input. ... (8 Replies)
Discussion started by: looney
8 Replies