|
List Info
Thread: ed scripts in Windows command shell
|
|
| ed scripts in Windows command shell |

|
2008-05-14 18:24:08 |
Although I have experience with diff and ed on *nix, I just
can't seem
to get ed to work in the Win32 environment (cmd.exe).
diff -e oldfile newfile > script.ed
gives the proper ed commands, but any variation of
type script.ed | ed oldfile > result
just won't work: I get either an empty result, or the last
line of the
original file repeated a few times in the result. I've tried
'for'
loops with 'echo' and 'type', appending 'w' and 'q' commands
to
script.ed, and all sorts of variations. Still no luck.
Has anyone had success using 'ed' commands with Win32?
P.S. I want to use the 'ed' output from diff, since several
'ed'
commands can be concatenated together to apply several
changes -
unlike 'context' and 'unified' diffs that have to be
appiled
individually against each intermediate result.
|
|
| Re: ed scripts in Windows command shell |

|
2008-05-15 16:27:53 |
On May 14, 4:24 pm, randall.h... gmail.com wrote:
> Although I have experience with diff and ed on *nix, I
just can't seem
> to get ed to work in the Win32 environment (cmd.exe).
>
> diff -e oldfile newfile > script.ed
>
> gives the proper ed commands, but any variation of
>
> type script.ed | ed oldfile > result
>
> just won't work: I get either an empty result, or the
last line of the
> original file repeated a few times in the result. I've
tried 'for'
> loops with 'echo' and 'type', appending 'w' and 'q'
commands to
> script.ed, and all sorts of variations. Still no luck.
>
> Has anyone had success using 'ed' commands with Win32?
>
> P.S. I want to use the 'ed' output from diff, since
several 'ed'
> commands can be concatenated together to apply several
changes -
> unlike 'context' and 'unified' diffs that have to be
appiled
> individually against each intermediate result.
P.P.S.
I'm trying to use the GnuWin32 ed utility.
|
|
| Re: ed scripts in Windows command shell |

|
2008-05-17 02:14:28 |
On Fri, 16 May 2008 07:27:53 +1000, <randall.harp gmail.com> wrote:
> On May 14, 4:24 pm, randall.h... gmail.com wrote:
>> Although I have experience with diff and ed on
*nix, I just can't seem
>> to get ed to work in the Win32 environment
(cmd.exe).
>>
>> diff -e oldfile newfile > script.ed
>>
>> gives the proper ed commands, but any variation of
>>
>> type script.ed | ed oldfile > result
>>
>> just won't work: I get either an empty result, or
the last line of the
>> original file repeated a few times in the result.
I've tried 'for'
>> loops with 'echo' and 'type', appending 'w' and 'q'
commands to
>> script.ed, and all sorts of variations. Still no
luck.
>>
>> Has anyone had success using 'ed' commands with
Win32?
>>
>> P.S. I want to use the 'ed' output from diff, since
several 'ed'
>> commands can be concatenated together to apply
several changes -
>> unlike 'context' and 'unified' diffs that have to
be appiled
>> individually against each intermediate result.
>
> P.P.S.
>
> I'm trying to use the GnuWin32 ed utility.
>
This worked:
ed < script.ed oldfile
Note that script.ed has "w" at the end to tell ed
to write the changes.
If you have multiple ed script files generated by diff, then
concatenate
all the script files and append "w" into one
script file. In cmd.exe:
(cat f1 f1 ... && echo w) > script.ed
Don't know GnuWin32's ed doesn't accept input from a pipe.
--
Kam-Hung Soh <a href="http://k
amhungsoh.com/blog">Software
Salariman</a>
|
|
| Re: ed scripts in Windows command shell |

|
2008-05-29 14:37:24 |
On May 17, 12:14 am, "Kam-Hung Soh"
<kamhung.... gmail.com> wrote:
> On Fri, 16 May 2008 07:27:53 +1000,
<randall.h... gmail.com> wrote:
> > On May 14, 4:24 pm, randall.h... gmail.com
wrote:
> >> Although I have experience with diff and ed on
*nix, I just can't seem
> >> to get ed to work in the Win32 environment
(cmd.exe).
>
> >> diff -e oldfile newfile > script.ed
>
> >> gives the proper ed commands, but any
variation of
>
> >> type script.ed | ed oldfile > result
>
> >> just won't work: I get either an empty result,
or the last line of the
> >> original file repeated a few times in the
result. I've tried 'for'
> >> loops with 'echo' and 'type', appending 'w'
and 'q' commands to
> >> script.ed, and all sorts of variations. Still
no luck.
>
> >> Has anyone had success using 'ed' commands
with Win32?
>
> >> P.S. I want to use the 'ed' output from diff,
since several 'ed'
> >> commands can be concatenated together to apply
several changes -
> >> unlike 'context' and 'unified' diffs that have
to be appiled
> >> individually against each intermediate
result.
>
> > P.P.S.
>
> > I'm trying to use the GnuWin32 ed utility.
>
> This worked:
>
> ed < script.ed oldfile
>
> Note that script.ed has "w" at the end to
tell ed to write the changes.
>
> If you have multiple ed script files generated by diff,
then concatenate
> all the script files and append "w" into one
script file. In cmd.exe:
>
> (cat f1 f1 ... && echo w) > script.ed
>
> Don't know GnuWin32's ed doesn't accept input from a
pipe.
>
> --
> Kam-Hung Soh <a href="http://k
amhungsoh.com/blog">Software
Salariman</a>- Hide quoted text -
>
> - Show quoted text -
Thanks for the reply.
Even when script.ed has a "w" (or "w"
and "q") appended to it,
oldfile remains unchanged. :-/
script.ed:
78a
public void noop();
.
w
----
ed < script.ed oldfile
doesn't change oldfile
ed oldfile < script.ed
doesn't change oldfile
I've had success with GnuWin32 'patch', applying incremental
diffs,
but just can't get 'ed' to work. If not for your 'This
worked", I
would conclude that 'ed' just can't be used this way in a
Win32
environment.
- Randall
|
|
| Re: ed scripts in Windows command shell |

|
2008-05-31 21:24:32 |
randall.harp gmail.com wrote:
> On May 17, 12:14 am, "Kam-Hung Soh"
<kamhung.... gmail.com> wrote:
>> On Fri, 16 May 2008 07:27:53 +1000,
<randall.h... gmail.com> wrote:
>>> On May 14, 4:24 pm, randall.h... gmail.com
wrote:
>>>> Although I have experience with diff and ed
on *nix, I just can't seem
>>>> to get ed to work in the Win32 environment
(cmd.exe).
>>>> diff -e oldfile newfile > script.ed
>>>> gives the proper ed commands, but any
variation of
>>>> type script.ed | ed oldfile > result
>>>> just won't work: I get either an empty
result, or the last line of the
>>>> original file repeated a few times in the
result. I've tried 'for'
>>>> loops with 'echo' and 'type', appending 'w'
and 'q' commands to
>>>> script.ed, and all sorts of variations.
Still no luck.
>>>> Has anyone had success using 'ed' commands
with Win32?
>>>> P.S. I want to use the 'ed' output from
diff, since several 'ed'
>>>> commands can be concatenated together to
apply several changes -
>>>> unlike 'context' and 'unified' diffs that
have to be appiled
>>>> individually against each intermediate
result.
>>> P.P.S.
>>> I'm trying to use the GnuWin32 ed utility.
>> This worked:
>>
>> ed < script.ed oldfile
>>
>> Note that script.ed has "w" at the end to
tell ed to write the changes.
>>
>> If you have multiple ed script files generated by
diff, then concatenate
>> all the script files and append "w" into
one script file. In cmd.exe:
>>
>> (cat f1 f1 ... && echo w) > script.ed
>>
>> Don't know GnuWin32's ed doesn't accept input from
a pipe.
>>
>> --
>> Kam-Hung Soh <a href="http://k
amhungsoh.com/blog">Software
Salariman</a>- Hide quoted text -
>>
>> - Show quoted text -
>
> Thanks for the reply.
>
> Even when script.ed has a "w" (or
"w" and "q") appended to it,
> oldfile remains unchanged. :-/
>
> script.ed:
>
> 78a
>
> public void noop();
> .
> w
>
> ----
>
> ed < script.ed oldfile
>
> doesn't change oldfile
>
> ed oldfile < script.ed
>
> doesn't change oldfile
>
> I've had success with GnuWin32 'patch', applying
incremental diffs,
> but just can't get 'ed' to work. If not for your 'This
worked", I
> would conclude that 'ed' just can't be used this way in
a Win32
> environment.
>
> - Randall
What a puzzle.
Which version of "ed" are you using? Mine is:
C:Temp>ed --version
GNU ed version 0.2
--
Kam-Hung Soh <a href="http://k
amhungsoh.com/blog">Software
Salariman</a>
|
|
[1-5]
|
|