Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading multiple file names into script

Status
Not open for further replies.

noiz

IS-IT--Management
Apr 19, 2001
17
US
I'm trying to write a script that will read a file
and then find the top words located in that file

i have the script down so it can read one file but want it to be able to read several files and loop.

ie.

input: fileA fileB fileC

script will read first fileA then fileB...fileC then prompt for additional files to check...until i ^D the proccess.

i already have the script to sort the filenames just cann't get the loop to work. thanks..

zion
<><
=-)
 
What kind of loop are you using?
Did you try a for loop?
For example, say I have a script called &quot;foo.ksh&quot; and this script format's the files I have a certain way. I could do this:
for z in file1 file2 file3 file4...etc
do
foo.ksh
done


This would run the &quot;foo.ksh&quot; script against all those files. d3funct
zimmer.jon@cfwy.com
The software required `Windows 95 or better', so I installed Linux.

 
defunct,

Thanks,

I'm trying to make my script able to read multiple file names at once. however i don't know how many the end user will put in. So i need a was to be able to read user input
and then proccess each file name entered by the user. When done the script returns to normal.

below is the script that will run inside my loop:
#!/bin/sh
#read test
#cat $test | tr -s ' ' '\012' > tmp1.tmp

#cat tmp1.tmp | tr &quot;[A-Z]&quot; &quot;[a-z]&quot; | sort -d > tmp3.tmp
#cat tmp3.tmp | uniq -c > tmp4.tmp
#sort -n tmp4.tmp > tmp5.tmp
#tail -50 tmp5.tmp
#rm tmp*

thanks again

zion
<><
=-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top