It takes this line: DEVICE and replaces it with this: DEVICE Lubuntu1:3551 Lubuntu1:3551
if (1) the original line really is DEVICE and (2) you have only run the script once on a given file, then i'm stumped. regarding (1), is it possible the original line reads DEVICE Lubuntu1:3551 instead? regarding (2), of all the calls to s/// in your script, it is notable that
-e 's/DEVICE/DEVICE Lubuntu1:3551/' \
is the only one that will modify its own output, if the script is run again. so if you run the script on a file twice, any line DEVICE will become first DEVICE Lubuntu1:3551 and then DEVICE Lubuntu1:3551 Lubuntu1:3551 -wes On Wed, 19 Dec 2012, John Hupp wrote:
I'm using a script with sed to modify a configuration file. The script: sed -i \ -e 's/UPSCABLE usb/UPSCABLE ether/' \ -e 's/UPSTYPE usb/UPSTYPE net/' \ -e 's/DEVICE/DEVICE Lubuntu1:3551/' \ -e 's/TIMEOUT 105/TIMEOUT 60/' \ -e 's/NETSERVER on/NETSERVER off/' \ -e 's/NISIP 0.0.0.0/NISIP 127.0.0.1/' /etc/apcupsd/apcupsd.conf It all works fine except for this substitution: -e 's/DEVICE/DEVICE Lubuntu1:3551/' It takes this line: DEVICE and replaces it with this: DEVICE Lubuntu1:3551 Lubuntu1:3551 Does anyone know why?
-- Lubuntu-users mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/lubuntu-users
