Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cp file with a filter



On Thu, 14 Jan 2010 17:58:14 -0500
Paul Hoffman <nkuitse@xxxxxxxxxxx> wrote:

> > 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

Is there a way to rewrite the number without having to type again?
As in re-executing the last command after a regular expression
substitution?




Messages sorted by: Reverse Date, Date, Thread, Author