[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-user
Subject: Re: [gentoo-user] OT: global search and replace
From: Christian Parpart <cparpart () surakware ! net>
Date: 2004-09-09 13:46:25
Message-ID: 200409091546.28181.cparpart () surakware ! net
[Download RAW message or body]
On Thursday 09 September 2004 1:23 pm, Andrew Ross wrote:
> On Thu, 2004-09-09 at 16:33, Alex wrote:
> > i keep one generic script like so :
> >
> > #!/bin/bash
> >
> > for file in `find . -name "*.php"`;
> > do vi -s replace-script $file;
> > done;
>
> Surely that would break when a file or directory contains spaces?
No reason to die ;)
#! /bin/sh
PATTERN="${1}"
REPLACE_SCRIPT="/tmp/${HOSTNAME}-${USER}-replacescript"
cat >${REPLACE_SCRIPT} <<EOF
:1,\$s/${PATTERN}/g
:wq
EOF
find . -name '*.php' -print -exec vi -s ${REPLACE_SCRIPT} {} \;
Cheers,
Christian Parpart.
--
15:42:31 up 16 days, 3:22, 0 users, load average: 0.37, 0.43, 0.39
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic