Question

Brad De Vries devriesbj
Mon May 17 11:37:53 PDT 2004


Rick, assuming these are not image files (i.e., do not
contain binary data) and also assuming that you are
running bash, you could write a simple shell script
like:

TMPFILE=/tmp/tmp.$RANDOM
for file in *.xpm; do
  echo "$file"
  sed -e "s/static/const/g" $file >
$TMPFILE
  cat $TMPFILE > $file;  # retains permissions,
etc.
done
rm $TMPFILE

HTH,
Brad.
--- "Richard R. Sivernell"
<res005ru at gte.net> wrote:
> List
> 
>   This may be stupid simple, that is why I am
here,
> my question is this:
> I have some files *.xpm that have a word static
in
> them. I want to change 
> the word to const. What is the easy way to to
have a
> script to open each file
> in a directory & change the word, save and
close the
> file.
> 
> Any help appreciated  Cheers
> 
> -- 
> Rick Sivernell
> Dallas, Texas  75287
> 972 306-2296
> res005ru at gte.net
> Caldera Open Linux eWorkStation 3.1.1
> Registered Linux User
> 
>    .~.
>   / v \r
>  /( _ )\r
>    ^ ^
> In Linux we trust!


__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com


More information about the Linux-users mailing list