I want to conditionally edit a file in a makefile: if the file
has 'xyzzy' the file should not be changed. The make action is
akin to
(echo 'g/xyzzy/q'; \
echo 'more ed commands' \
echo ... \
echo wq) | ed file
Siri Cruise <[email protected]> writes:
I want to conditionally edit a file in a makefile: if the file
has 'xyzzy' the file should not be changed. The make action is
akin to
(echo 'g/xyzzy/q'; \
echo 'more ed commands' \
echo ... \
echo wq) | ed file
It's the ;. This works for me:
(echo 'g/xyzzy/q
another cmd
and another
w
q
') | ed file
But I'd consider some other way myself. Something like
grep -q xyzzy file || some other command to edit the file
In article <[email protected]>,
Ben Bacarisse <[email protected]> wrote:
Siri Cruise <[email protected]> writes:
I want to conditionally edit a file in a makefile: if the file
has 'xyzzy' the file should not be changed. The make action is
akin to
(echo 'g/xyzzy/q'; \
echo 'more ed commands' \
echo ... \
echo wq) | ed file
It's the ;. This works for me:
(echo 'g/xyzzy/q
another cmd
and another
w
q
') | ed file
But I'd consider some other way myself. Something like
grep -q xyzzy file || some other command to edit the file
That requires hunting down the makefile segments and driving
stqkes through their hearts, which I hoped to void.
'You Americans. You make everything so simple so complicated.'
Siri Cruise <[email protected]> writes:
I want to conditionally edit a file in a makefile: if the file has
'xyzzy' the file should not be changed. The make action is akin to
(echo 'g/xyzzy/q'; \
echo 'more ed commands' \
echo ... \
echo wq) | ed file
It's the ;. This works for me:
In article <[email protected]et>,
Eric Pozharski <[email protected]> wrote:
chine.bleu@, GNU ed doesn't do any command suffixes except those that
print (namely, 'l', 'p', 'n') (because, "Just because?", I guess).
By command suffix you mean the '...' in 'g/re/...', correct?
[expletive deleted]. My alternative has been tclsh to read the
file, modify it with regsub etc, and write it back. I guess I'll
have to do that from now. ed doesn't do much, but it was easy to
invoke and I assumed would be universally equivalent on all
unices.
chine.bleu@, GNU ed doesn't do any command suffixes except those that
print (namely, 'l', 'p', 'n') (because, "Just because?", I guess).
| In article <[email protected]et>,
| Eric Pozharski <[email protected]> wrote:
| > chine.bleu@, GNU ed doesn't do any command suffixes except those that
| > print (namely, 'l', 'p', 'n') (because, "Just because?", I guess).
| By command suffix you mean the '...' in 'g/re/...', correct?
| [expletive deleted]. My alternative has been tclsh to read the
| file, modify it with regsub etc, and write it back. I guess I'll
| have to do that from now. ed doesn't do much, but it was easy to
| invoke and I assumed would be universally equivalent on all unices.
*headscratch* What's wrong with 'sed'? Though I don't know if that
suffers the same deficiencies between platforms as 'ed'...
In article <[email protected]et>, Eric Pozharski <[email protected]> wrote:
chine.bleu@, GNU ed doesn't do any command suffixes except those thatBy command suffix you mean the '...' in 'g/re/...', correct?
print (namely, 'l', 'p', 'n') (because, "Just because?", I guess).
[expletive deleted]. My alternative has been tclsh to read the file,
modify it with regsub etc, and write it back. I guess I'll have to do
that from now. ed doesn't do much, but it was easy to invoke and I
assumed would be universally equivalent on all unices.
In last 12 month I've went through sources of pdns-recursor, dcron
(fscking vaporware),
pppd, comgt, perl, and zsh. I don't know what are
you talking about and I'm not interested. I'm burnt out. I'm glad you realized the dead-end early enough.
In last 12 month I've went through sources of pdns-recursor, dcronI'm curious. Can you elaborate on "dcron (fscking vaporware)"?
(fscking vaporware),
pppd, comgt, perl, and zsh. I don't know what are you talking aboutJust eavesdripping ;-)
and I'm not interested. I'm burnt out. I'm glad you realized the
dead-end early enough.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (3 / 13) |
| Uptime: | 142:59:00 |
| Calls: | 12,089 |
| Calls today: | 2 |
| Files: | 14,998 |
| Messages: | 6,517,457 |