Quantcast
Viewing latest article 2
Browse Latest Browse All 16

Translating Filenames — Bash Voodoo Style #linux

This is an example of using Bash to convert a crazy apache log and translating the filename into an IIS log pattern:

d=`date +%Y%m%d`
find k -type f \
| while read filename
do
  nextfile="${filename/k\/done?0.www\./k2/www-Server_T${d}_}.log"
  echo "$nextfile"
  cat $filename | $translate > "$nextfile"
done

I love how I can refer to a shell variable ($d) inside a string translation (${d}).


Filed under: computing, F/LOSS, Linux, Programming, Windows Tagged: Apache, bash, iis, Linux, Windows Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 2
Browse Latest Browse All 16

Trending Articles