Computing.Net > Forums > Unix > shell script to extract information

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

shell script to extract information

Reply to Message Icon

Original Message
Name: Tonto22
Date: May 24, 2004 at 15:53:33 Pacific
Subject: shell script to extract information
OS: unix
CPU/Ram: s
Comment:

I have a directorey with some .xls files in it. I want to extract some information from these files (I'll be doing that with a php program).

I need a shell script that will invoke this program repetitively for each of the files in the directory.

Any help would be highly appreciated.

thanks.


Report Offensive Message For Removal


Response Number 1
Name: R_ajes_h
Date: May 24, 2004 at 16:15:32 Pacific
Reply: (edit)

Try this:

#!/bin/sh
DIRECTORY=/excels/
ls $DIRECTORY |grep xls | while read FILE
do
<Program Name> $FILE
done


Report Offensive Follow Up For Removal

Response Number 2
Name: Dlonra
Date: May 25, 2004 at 05:39:50 Pacific
Reply: (edit)

more commonly:

#!/bin/sh
DIRECTORY=/excels/
cd $DIRECTORY
for $FILE in *.xls
do
<Program Name> $FILE
done


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software