You can use perl's glob operator (type perldoc -f glob at the command
prompt for help)
Wrap your script, except the exit(0) by

  while (<$some_dir_name/*.txt>) { # Assuming you are searching for .txt
files.
   }

hth,
Sudarsan

pn wrote:

> Hello,
>
> My question:  I would like to be able to have the
> automically open all the files in a given directory,
> one at a time, perform the "sed" operations, and then
> save them to the directory. How can I do this ?
>
> Here is the script:
>
> #!/usr/bin/perl -w
>
> open (IN,"< orig_names.txt");
> open (OUT,">mod_names.txt");
>
> while (<IN>) {
>     chomp;
>     if ($_=~/^lname/i) {
>
>         s/holt/henning/;
>         s/shultz/stultz/;
>
>     }
>
> }
> close (IN);
> close (OUT);
> exit(0);
>
> I would greatly appreciate your help in this regards.
>
> Thanks
>
> PN


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to