On Fri, Nov 16, 2001 at 01:31:30PM -0500, David T-G wrote:
> I created /tmp/ed.sh which looks like
> 
>   #!/bin/sh
>   
>   perl -e '
>     open MUTTI, "< '$1'";
>     open MUTTO, ">'$1'.out";
>     while(<MUTTI>)
>       {
>         print("-");   ###
>         print(MUTTO "  $_");
>       }
>       print("\n");    ###
>     close MUTTI;
>     close MUTTO;
>     '
>   mv -f $1.out $1
>   
>   vim +/^$ $*
> 
> and set my $editor to that (note the clever unquoting of $1 in the open
> lines) and, sure enough, found my entire file indented by two lines.
> 
> I let mutt put together the headers and the body and then hand it to the
> "editor", which I've specified as a wrapper which will first manipulate
> the file it's handed.
> 
> Now, I know that there is a way to edit in place in perl and skip the
> temp file, but it doesn't pop to mind.  I could do it easily in ed but
> that would probably be tough to use to grab the Subject: line and
> generate a Cc: line :-)

perl -i -n -e 's/^/-  /;' $1

something like this? :)


-- 
Dan Boger
Linux MVP
brainbench.com

Attachment: msg20511/pgp00000.pgp
Description: PGP signature

Reply via email to