Solved

process a group of files

Posted on 1998-06-10
2
214 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
Comment Utility
Edited text of question
0
 
LVL 1

Accepted Solution

by:
zonker031798 earned 50 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 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

10 Experts available now in Live!

Get 1:1 Help Now