[Lubuntu] Sed substitution with partially duplicate results

carsrcoffins23 at yahoo.com
Wed Dec 19 22:31:33 UTC 2012


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> 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
> 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/20121219/e82c288c/attachment-0001.html>


More information about the Lubuntu-users mailing list