Solved

process a group of files

Posted on 1998-06-10
2
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

734 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