Solved

process a group of files

Posted on 1998-06-10
2
219 Views
Last Modified: 2012-05-04
Hello,
I have an executable program can only read one file one time and process it and write output to a new created file.
How can I invoke it one time to process all the files in current directory .

actually I would like to do something like this: " processing_program  *  "

Thanks
0
Comment
Question by:tian
2 Comments
 

Author Comment

by:tian
ID: 2007862
Edited text of question
0
 
LVL 1

Accepted Solution

by:
zonker031798 earned 50 total points
ID: 2007863
You can write a shell script which iterates through each
file in the current directory, invoking your executable program
on each one.

Let's say that your executable program is called "ep".  Then
in the csh, you could do this:

foreach i (*)
      ep  < $i > $i.output
end

Or in the Bourne shell, you could do this:

for i in *
do
      ep < $i > $i.output
done

If you'd like to monitor the progress of your script as it
runs the program on each file, then add an "echo" statement
inside the loop along the lines of:

      echo "ep now working on $i"


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now