<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can't get sed to replace string with semicolon. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5688309#M53709</link>
    <description />
    <pubDate>Wed, 13 Jun 2012 00:50:24 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2012-06-13T00:50:24Z</dc:date>
    <item>
      <title>Can't get sed to replace string with semicolon.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5688209#M53708</link>
      <description>&lt;P&gt;I am writing a bash script. In the file /etc/samba/smb.conf, I wish to substitute the string:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; realm = MY_REALM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with the string:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; realm = GROUP.COM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;notice the semicolon is gone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SED sees the semicolon as special, and I don't know AWK. Anyone got a one liner:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again to all who respond to my questions regularly,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To describe my problem in fuller detail as suggested, the command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sed -i 's/";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; realm = MY_REALM"/"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; realm = GROUP.COM"/g' /etc/samba/smb.conf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;has issues with the semicolon.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:51:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5688209#M53708</guid>
      <dc:creator>Fred Abell</dc:creator>
      <dc:date>2012-06-13T12:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get sed to replace string with semicolon.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5688309#M53709</link>
      <description />
      <pubDate>Wed, 13 Jun 2012 00:50:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5688309#M53709</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2012-06-13T00:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get sed to replace string with semicolon.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689011#M53710</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;has issues with the semicolon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Maybe, but not in this example. And a semicolon may be special for a shell, but it looks like it is already escaped so that the shell should leave it alone. The quoting you use, asks sed to look for a double quoted string to be replaced by another double quoted string. I don't think you have such quoted strings in the file. So&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;sed -i 's/; &amp;nbsp; &amp;nbsp; &amp;nbsp; realm = MY_REALM/ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;realm = GROUP.COM/g'&amp;nbsp;/etc/samba/smb.conf&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;should do.&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 Jun 2012 14:57:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689011#M53710</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2012-06-13T14:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get sed to replace string with semicolon.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689785#M53711</link>
      <description />
      <pubDate>Thu, 14 Jun 2012 05:42:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689785#M53711</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2012-06-14T05:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get sed to replace string with semicolon.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689899#M53712</link>
      <description>&lt;P&gt;&amp;gt;has issues with the semicolon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As Steven said, you have issues with whitespace, not semicolon.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2012 07:19:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/can-t-get-sed-to-replace-string-with-semicolon/m-p/5689899#M53712</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-06-14T07:19:00Z</dc:date>
    </item>
  </channel>
</rss>

