Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cp file with a filter
- X-seq: zsh-users 14712
- From: Paul Hoffman <nkuitse@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: cp file with a filter
- Date: Thu, 14 Jan 2010 17:58:14 -0500
- In-reply-to: <Xns9D00DA47D5E30zzappergmailcom@xxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <Xns9D00DA47D5E30zzappergmailcom@xxxxxxxxxxxx>
On Thu, Jan 14, 2010 at 09:27:31PM +0000, zzapper wrote:
> Hi
>
>
> I want to copy a file to various subdirectories while changing a value in the
> file on the fly
>
> eg
> cat init.php | sed s/flag=2/flag=3/ > dir3/init.php
> cat init.php | sed s/flag=2/flag=4/ > dir4/init.php
>
> where there is a relationship between the directory name and flag value
> (I know I could extract the number of the directory using the php)
typeset -a flags
flags=( 3 4 )
for f in $flags; do
sed "s/flag=2/flag=$f/" init.php > dir$f/init.php
done
Paul.
--
Paul Hoffman <nkuitse@xxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author