<?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: Sed?? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066036#M94556</link>
    <description>Got wat i wanted!</description>
    <pubDate>Thu, 30 Aug 2007 22:15:23 GMT</pubDate>
    <dc:creator>Rinky</dc:creator>
    <dc:date>2007-08-30T22:15:23Z</dc:date>
    <item>
      <title>Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066020#M94540</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a comma seperated file. The second field in it is a description field.&lt;BR /&gt;But has new line character within the field.&lt;BR /&gt;I want the new line character to be removed so that the description field comes in the same line.&lt;BR /&gt;&lt;BR /&gt;For eg: In the file if it is:&lt;BR /&gt;10000,"Today&lt;BR /&gt;is a holiday"&lt;BR /&gt;&lt;BR /&gt;I want it to be &lt;BR /&gt;10000,"Today is a holiday"&lt;BR /&gt;&lt;BR /&gt;Please help..</description>
      <pubDate>Thu, 30 Aug 2007 02:21:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066020#M94540</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-08-30T02:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066021#M94541</link>
      <description>&lt;!--!*#--&gt;You'll have to explain in more detail.  Are ALL lines broken up?  Or only some?  Or do you need to look for a mismatched "?&lt;BR /&gt;Or any line with a " is mismatched?&lt;BR /&gt;&lt;BR /&gt;If the lines are always broken in pairs, then you could possibly use sed.  But if you have to check, you need awk:&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;inx = index($0, "\"")&lt;BR /&gt;if (inx != 0) {&lt;BR /&gt;   save = $0&lt;BR /&gt;   getline&lt;BR /&gt;   print save, $0&lt;BR /&gt;   next&lt;BR /&gt;}&lt;BR /&gt;print&lt;BR /&gt;}' file</description>
      <pubDate>Thu, 30 Aug 2007 03:22:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066021#M94541</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-30T03:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066022#M94542</link>
      <description>Ok..&lt;BR /&gt;Only some lines have this problem. Probably a search for mismathced " will do in a line..&lt;BR /&gt;how do we accomplish tat?</description>
      <pubDate>Thu, 30 Aug 2007 03:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066022#M94542</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-08-30T03:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066023#M94543</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;If all lines are broken use edit file with vi editor, enter :g/./join&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Marcin</description>
      <pubDate>Thu, 30 Aug 2007 03:52:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066023#M94543</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-30T03:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066024#M94544</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Probably a search for mismathced " will do in a line..  how do we accomplish that?&lt;BR /&gt;&lt;BR /&gt;This assumes that the second field has quotes, not the first nor any other.&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;inx = index($0, "\"")&lt;BR /&gt;if (inx != 0) {&lt;BR /&gt;   rest = substr($0, inx + 1) # after quote&lt;BR /&gt;   inx = index(rest, "\"")&lt;BR /&gt;   if (inx == 0) {  # mismatched&lt;BR /&gt;      save = $0&lt;BR /&gt;      getline&lt;BR /&gt;      print save, $0 #join lines&lt;BR /&gt;      next&lt;BR /&gt;   }&lt;BR /&gt;}&lt;BR /&gt;print&lt;BR /&gt;}' file&lt;BR /&gt;&lt;BR /&gt;I suppose if you had an arbitrarily complex case you could set the delimiter to ", then if the number of fields was even, then join lines.</description>
      <pubDate>Thu, 30 Aug 2007 04:05:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066024#M94544</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-30T04:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066025#M94545</link>
      <description>If all lines start from numeric and only broken line have to be processed you may use in vi&lt;BR /&gt;&lt;BR /&gt;:v/^[0-9]/-1j&lt;BR /&gt;&lt;BR /&gt;and only broken line will be connected&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Marcin</description>
      <pubDate>Thu, 30 Aug 2007 04:11:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066025#M94545</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-30T04:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066026#M94546</link>
      <description>&amp;gt;Marcin may use in vi&lt;BR /&gt;:v/^[0-9]/-1j&lt;BR /&gt;&amp;gt;and only broken line will be connected&lt;BR /&gt;&lt;BR /&gt;I'm at a loss on how to get that to work and why it would work.&lt;BR /&gt;It seems you are executing the ex(1) visual command from the vi ":" prompt??&lt;BR /&gt;&lt;BR /&gt;Or did you mean "g" instead of "v"?&lt;BR /&gt;Ah, you're using a foreign devil vim instead of vi.  And "v" did work but I still don't know why.</description>
      <pubDate>Thu, 30 Aug 2007 04:57:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066026#M94546</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-30T04:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066027#M94547</link>
      <description>Hi Dennis&lt;BR /&gt;&lt;BR /&gt;I using standard hp-ux vi.&lt;BR /&gt;And there is no mistake with "v", "v" - inverts the search, ex. ":v/./d" = ":g/^$/d" (delete all empty lines)&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Marcin</description>
      <pubDate>Thu, 30 Aug 2007 05:17:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066027#M94547</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-30T05:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066028#M94548</link>
      <description>&amp;gt;Marcin: I using standard hp-ux vi.&lt;BR /&gt;&lt;BR /&gt;Hmm, it works now.  I don't know what I did to get it to fail.  ??&lt;BR /&gt;&lt;BR /&gt;&amp;gt;And there is no mistake with "v", "v" - inverts the search,&lt;BR /&gt;&lt;BR /&gt;You can only find it in ex(1) if you know v is related to g or global.  They don't list it alphabetically under v.  And don't have flashing red lights.  :-(&lt;BR /&gt;It is in the Abbreviations box.&lt;BR /&gt;&lt;BR /&gt;Thanks for the info.  Though if you used g!, it would have been easier to figure it out.</description>
      <pubDate>Thu, 30 Aug 2007 06:01:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066028#M94548</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-30T06:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066029#M94549</link>
      <description>Rinky, please assign points.</description>
      <pubDate>Thu, 30 Aug 2007 06:18:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066029#M94549</guid>
      <dc:creator>Marcin O.</dc:creator>
      <dc:date>2007-08-30T06:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066030#M94550</link>
      <description>If not resolved yet, then this perl should do it. It just checks field 2 as written:&lt;BR /&gt;&lt;BR /&gt;perl -pe 'if (!/^.*?,".*?"/ &amp;amp;&amp;amp; !eof) { chomp; $_ .=&amp;lt;&amp;gt; }' old &amp;gt; new&lt;BR /&gt;&lt;BR /&gt;To check any field (including 2), leave the begin-of-line anchor of:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;perl -pe 'if (!/,".*?"/ &amp;amp;&amp;amp; !eof) { chomp; $_ .=&amp;lt;&amp;gt; }' old &amp;gt; new&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Aug 2007 07:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066030#M94550</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-30T07:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066031#M94551</link>
      <description>Hi Rinky:&lt;BR /&gt;&lt;BR /&gt;Another Perl:&lt;BR /&gt;&lt;BR /&gt;# perl -ni.old -e 'if (!m/"$/) {chomp;print $_." "} else {print}' file&lt;BR /&gt;&lt;BR /&gt;This will also update your file in situ (in place) leaving an unmodified copy as "file.old".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Aug 2007 07:50:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066031#M94551</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-30T07:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066032#M94552</link>
      <description>Try the sed construct below:&lt;BR /&gt;&lt;BR /&gt;# sed 'N;s/\n/ /p' file</description>
      <pubDate>Thu, 30 Aug 2007 08:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066032#M94552</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-30T08:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066033#M94553</link>
      <description>&amp;gt;Sandman: Try the sed construct below:&lt;BR /&gt;# sed 'N;s/\n/ /p' file&lt;BR /&gt;&lt;BR /&gt;This was rejected as not every line had the problem.</description>
      <pubDate>Thu, 30 Aug 2007 16:40:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066033#M94553</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-30T16:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066034#M94554</link>
      <description>&amp;gt;Only some lines have this problem. Probably a search for mismathced " will&lt;BR /&gt;&amp;gt;do in a line..&lt;BR /&gt;&lt;BR /&gt;Good point Dennis...hadn't read the entire thread until now and based on requirements try the construct below which might be what Rinky's looking for:&lt;BR /&gt;&lt;BR /&gt;# sed '/"$/!N;s/\n/ /p' file</description>
      <pubDate>Thu, 30 Aug 2007 16:52:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066034#M94554</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-30T16:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066035#M94555</link>
      <description>Thanks everybody:)</description>
      <pubDate>Thu, 30 Aug 2007 22:14:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066035#M94555</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-08-30T22:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sed??</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066036#M94556</link>
      <description>Got wat i wanted!</description>
      <pubDate>Thu, 30 Aug 2007 22:15:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sed/m-p/5066036#M94556</guid>
      <dc:creator>Rinky</dc:creator>
      <dc:date>2007-08-30T22:15:23Z</dc:date>
    </item>
  </channel>
</rss>

