<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="-1">On 12/19/2012 3:57 PM, wes wrote:<br>
</font>
<blockquote
cite="mid:alpine.DEB.2.00.1212191529510.4614@brutus.ling.ohio-state.edu"
type="cite">
<blockquote type="cite"><font size="-1">It takes this line:
<br>
DEVICE
<br>
and replaces it with this:
<br>
DEVICE Lubuntu1:3551 Lubuntu1:3551
<br>
</font></blockquote>
<font size="-1">
<br>
if (1) the original line really is
<br>
<br>
DEVICE
<br>
<br>
and (2) you have only run the script once on a given file, then
i'm stumped.
<br>
<br>
<br>
regarding (1), is it possible the original line reads
<br>
<br>
DEVICE Lubuntu1:3551
<br>
<br>
instead?
<br>
<br>
<br>
regarding (2), of all the calls to s/// in your script, it is
notable that
<br>
<br>
</font>
<blockquote type="cite"><font size="-1"> -e 's/DEVICE/DEVICE
Lubuntu1:3551/' \
<br>
</font></blockquote>
<font size="-1">
<br>
is the only one that will modify its own output, if the script
is run again.
<br>
<br>
so if you run the script on a file twice, any line
<br>
<br>
DEVICE
<br>
<br>
will become first
<br>
<br>
DEVICE Lubuntu1:3551
<br>
<br>
and then
<br>
<br>
DEVICE Lubuntu1:3551 Lubuntu1:3551
<br>
<br>
<br>
-wes
<br>
<br>
On Wed, 19 Dec 2012, John Hupp wrote:
<br>
<br>
</font>
<blockquote type="cite"><font size="-1">I'm using a script with
sed to modify a configuration file. The script:
<br>
<br>
sed -i \
<br>
-e 's/UPSCABLE usb/UPSCABLE ether/' \
<br>
-e 's/UPSTYPE usb/UPSTYPE net/' \
<br>
-e 's/DEVICE/DEVICE Lubuntu1:3551/' \
<br>
-e 's/TIMEOUT 105/TIMEOUT 60/' \
<br>
-e 's/NETSERVER on/NETSERVER off/' \
<br>
-e 's/NISIP 0.0.0.0/NISIP 127.0.0.1/'
<br>
/etc/apcupsd/apcupsd.conf
<br>
<br>
It all works fine except for this substitution:
<br>
-e 's/DEVICE/DEVICE Lubuntu1:3551/'
<br>
<br>
It takes this line:
<br>
DEVICE
<br>
and replaces it with this:
<br>
DEVICE Lubuntu1:3551 Lubuntu1:3551
<br>
<br>
Does anyone know why?
<br>
</font><br>
</blockquote>
<font size="-1"><br>
</font></blockquote>
<font size="-1"><font size="-1">That is a nice observation. I
created the script on an LTSP server and then ran a utility to
create a network boot image from the server environment. And
since first writing, I tested the script (again?) on the server,
where it runs as expected without creating the duplicate
"Lubuntu1:3551". So it is only on the client where the
duplicate appears.<br>
<br>
I am forwarding this to the LTSP list to see if anyone there can
figure out how the script could be running twice.<br>
</font><br>
<br>
</font>
</body>
</html>