Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cp file with a filter
- X-seq: zsh-users 14713
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: cp file with a filter
- Date: Fri, 15 Jan 2010 08:53:26 +0000 (UTC)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns9D00DA47D5E30zzappergmailcom@xxxxxxxxxxxx> <20100114225814.GB24626@xxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Paul Hoffman wrote in news:20100114225814.GB24626@xxxxxxxxxxxx:
>>
>> 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
>
> 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.
>
thanks ; which in turn can be written
for i in {3,4}; sed s/flag=2/flag=$i/ init.php > dir$i/init.php
BTW apparently I was guilty of a UUOC
--
zzapper
http://zzapper.co.uk/ Technical Tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author