[Chicago-talk] Q on wildcards in output options..

Steven Lembark lembark at jeeves.wrkhors.com
Wed Oct 15 00:46:54 CDT 2003

--On Monday, October 13, 2003 17:31:38 -0500 Walter Torres 
<walter at torres.ws> wrote:

> OK, it happened.
> I've been asked to allow wildcards in an output option to my little log
> parser.
> I've got wildcards in...
>     >cleaner /my/dir/200309*.log -o /my/other/dir
> but now they want...
>     >cleaner /my/dir/200309*.log -o /my/other/dir/*.out.log
> beside RegExp, I can't think of a clean way to handle this.
> Any pointers on this?

Separate the switches into --outdir and --suffix. There really
is no way to perform this kind of "substitution" since the shell
will be expanding the '*' into whatever happens to be there --
or the original string if no files match when the command is run.

It sounds as though they want something that will append a suffix
to the input files to show that they have been processed. In that

    my $base = basename $path;
    my $path = $outdir . '/' . $base . '.' . $suffix;

    open my $outfh, '>', $path or die "trying...";

This will turn /foo/bar/input.file into /out/dir/input.file.suffix
after processing.

Steven Lembark                                            2930 W. Palmer
Workhorse Computing                                    Chicago, IL 60647
                                                         +1 888 910 1206

More information about the Chicago-talk mailing list