Solved

process a group of files

Posted on 1998-06-10
2
222 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

828 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