[plug] bash script help needed

Daniel Pittman daniel at rimspace.net
Sun Sep 11 13:18:48 WST 2011

On Sat, Sep 10, 2011 at 22:15, Chris Griffin <griffinster at gmail.com> wrote:

> I have a large collection of special binary log files that I need to export
> to ascii format.
> This system has a utility to do this but it will only take one file name at
> a time, no wild carding.
> Like:   exportlog -i input-filename -o output-filename
> the file names all look like:  2011-05-19_235900.log
> the date part for this lot will all start with 2011 but the rest of the date
> and time fields can and do vary.
> Could someone please help out with a bash script to do this, I can easily
> put all the names into a text file if necessary.

All of them?  Easy.

] for filename in *.log; do echo exportlog -i "$f{filename}" -o
"${filename/.log/.text}"; done

See the bash manual for the details on the text substitution I did
during variable expansion on output.  (Searching for '##' or '%%' is
easier than searching for the forward slash, in the documentation,

Put whatever pattern into the '*.log' bit you want.

♲ Made with 100 percent post-consumer electrons

More information about the plug mailing list