[Lubuntu] Sed substitution with partially duplicate results
John Hupp
lubuntu at prpcompany.com
Thu Dec 20 15:23:58 UTC 2012
Concerning escaping the colon: I still have the thinnest possible
understanding of the finer points of sed and the substitution syntax,
especially about escaping special characters. I don't even know if the
backslash would go before or after the colon!
But I had wondered about the possible effect of that colon myself.
I ran a modified version of your suggested test, replacing the colon
with a space:
sed -e 's/DEVICE/DEVICE Lubuntu13551/'
Now on the LTSP client, the resulting line is:
DEVICE Lubuntu1:3551 Lubuntu1 3551
------------------
I also tried
sed -e 's/DEVICE$/DEVICE Lubuntu1:3551/'
And that had no effect whatsoever. The result was still "DEVICE
Lubuntu1:3551 Lubuntu1:3551".
------------------
My current thought is this: I think the LTSP clients use a static,
read-only network boot image + a writable union filesystem overlaying
the read-only image. I have seen only the slimmest mention of it in
writing, however. Perhaps I'm not searching with the right termsto find
better documentation. But if that overlay has persistence, then perhaps
there could be results like the above. As someone suggested earlier,
it's as if the script had been run twice. Well perhaps it is being run
multiple times over succeeding boots and being applied to a persistent
overlay.
I tried earlier to copy an alternative version of the whole config file
in the script instead of using sed, and that failed, but I'm going to
try that again. If it works, I think it would overcome a
persistent-overlay behavior with sed.
And I'll try my persistent-overlay theory with the LTSP list folks. They
are the ones who should know about that.
On 12/19/2012 5:31 PM, ∅ wrote:
>
> If you escape the colon with a backslash does that fix it? A colon is
> a potential delimiter although that seems to be unexpected output
> regardless.
>
> wxl
>
> On Dec 19, 2012 2:27 PM, "Jonathan Marsden" <jmarsden at fastmail.fm
> <mailto:jmarsden at fastmail.fm>> wrote:
>
> John,
>
> On 12/19/2012 01:16 PM, John Hupp wrote:
>
> >>> It all works fine except for this substitution:
> >>> -e 's/DEVICE/DEVICE Lubuntu1:3551/'
>
> If the original line concerned starts out as just DEVICE (followed
> by a
> line feed to mark the end of line), then I'd suggest making the sed
> command be
>
> sed -e 's/DEVICE$/DEVICE Lubuntu1:5551/'
>
> So that, even if run twice, the second run will have no effect on
> this line.
>
> If there *is* "other junk" after DEVICE before the end of the
> line, and
> there is only one line containing DEVICE in the file concerned, you
> could consider
>
> sed -e 's/DEVICE.*$/DEVICE Lubuntu1:3551/'
>
> which would remove any trailing junk after DEVICE and replace it with
> the desired string.
>
> Jonathan
>
>
> --
> Lubuntu-users mailing list
> Lubuntu-users at lists.ubuntu.com <mailto:Lubuntu-users at lists.ubuntu.com>
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/lubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/lubuntu-users/attachments/20121220/8160ce8a/attachment.html>
More information about the Lubuntu-users
mailing list