[PLUG] The Right Tool For the Job

wes plug at the-wes.com
Mon Jul 27 17:54:03 UTC 2015


On Mon, Jul 27, 2015 at 7:55 AM, Rich Shepard <rshepard at appl-ecosys.com>
wrote:

>
>    Before writing such a script advice on a (or most) appropriate tool
> would
> be helpful. Would awk be the appropriate tool for this? Should be a short
> script so perhaps a linux utility would be a parsimonious working solution.
>
> Rich
>
>
Awk is for modifying existing data. You are adding completely new lines, so
the best tool for the job would be cat.

for filename in /path/to/app/source/*py

do if ! grep wxversion $filename

then echo "import wxversion
wxversion.select('3.0.2.0')
import os, time, wx" > $filename.new

cat $filename >> $filename.new

mv $filename.new $filename

fi

done

-wes



More information about the PLUG mailing list