<?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: awk or sed? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427466#M859271</link>
    <description>Hein,&lt;BR /&gt;&lt;BR /&gt;Looks good. Execept I get a trailing ) after the four.&lt;BR /&gt;&lt;BR /&gt;$ perl -pe 's/^\(//;s/\)$//;s/\) \(/ /g' test.txt&lt;BR /&gt;&lt;BR /&gt;one two three (test) (test1) four)&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
    <pubDate>Mon, 22 Nov 2004 09:12:23 GMT</pubDate>
    <dc:creator>David Burgess</dc:creator>
    <dc:date>2004-11-22T09:12:23Z</dc:date>
    <item>
      <title>awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427462#M859267</link>
      <description>I've got a file that was created from a database extract. Each field has ()'s round it. I want to strip the brackets out. Simple except some of the fields contain brackets inside them and these need to stay. For example :-&lt;BR /&gt;&lt;BR /&gt;(one) (two) (three (test)) ((test1) five)&lt;BR /&gt;&lt;BR /&gt;Each row has a variable number of fields.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Mon, 22 Nov 2004 08:51:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427462#M859267</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-11-22T08:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427463#M859268</link>
      <description>&lt;BR /&gt;Sounds like you can safely remove the leading open and trailing close parens.&lt;BR /&gt;Furthermore, you can remove any close-space-open combos.&lt;BR /&gt;Suggesting the following solution:&lt;BR /&gt;&lt;BR /&gt;perl -pe 's/^\(//;s/\)$//;s/\) \(/ /g' file&lt;BR /&gt;&lt;BR /&gt;Or if you do not need the space between open/close:&lt;BR /&gt;&lt;BR /&gt;perl -pe 's/^\(|\)$|\) \(//g' x&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Nov 2004 09:01:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427463#M859268</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-11-22T09:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427464#M859269</link>
      <description>Hmmm.&lt;BR /&gt;&lt;BR /&gt;sed could be used to prepare the data by strpping out all brackets.&lt;BR /&gt;&lt;BR /&gt;sed s/(/ /g $varname&lt;BR /&gt;&lt;BR /&gt;same thing for the close bracket.&lt;BR /&gt;&lt;BR /&gt;Then a standard awk command&lt;BR /&gt;&lt;BR /&gt;cat $var | awk `{print $1 $2 $3}`&lt;BR /&gt;&lt;BR /&gt;So my answer with some tweaks is probably both.&lt;BR /&gt;&lt;BR /&gt;cut command might be useful in replacing the awk command.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 22 Nov 2004 09:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427464#M859269</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-11-22T09:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427465#M859270</link>
      <description>What if the parens are to be saved if escaped?&lt;BR /&gt;&lt;BR /&gt;(one \()(two)(\)three) ...&lt;BR /&gt;&lt;BR /&gt;In that case Parse::RecDescent might help&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 22 Nov 2004 09:10:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427465#M859270</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-11-22T09:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427466#M859271</link>
      <description>Hein,&lt;BR /&gt;&lt;BR /&gt;Looks good. Execept I get a trailing ) after the four.&lt;BR /&gt;&lt;BR /&gt;$ perl -pe 's/^\(//;s/\)$//;s/\) \(/ /g' test.txt&lt;BR /&gt;&lt;BR /&gt;one two three (test) (test1) four)&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Mon, 22 Nov 2004 09:12:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427466#M859271</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-11-22T09:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427467#M859272</link>
      <description>Probably a space after the final paren.&lt;BR /&gt;Those are hard to 'see' in the itrc forums.&lt;BR /&gt;You'd have to append a few lines froma real file to analyze that.&lt;BR /&gt;&lt;BR /&gt;If it is just optional trailing space(s) you can capture those with: \)\s*$&lt;BR /&gt;&lt;BR /&gt;so:&lt;BR /&gt;&lt;BR /&gt;perl -pe 's/^\(|\)\s*$|\) \(//g' x&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Nov 2004 09:21:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427467#M859272</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-11-22T09:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427468#M859273</link>
      <description>use tr command to do this easily as,&lt;BR /&gt;&lt;BR /&gt; # echo "(one) (two) (three (test)) ((test1) five)" | tr -d '()'&lt;BR /&gt;one two three test test1 five&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Mon, 22 Nov 2004 10:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427468#M859273</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-11-22T10:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427469#M859274</link>
      <description>sorry again.&lt;BR /&gt;using sed you can do this as,&lt;BR /&gt;# echo "(one) (two) (three (test)) ((test1) five)" | sed "s/(//g;s/)//g"&lt;BR /&gt;one two three test test1 five&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Mon, 22 Nov 2004 10:19:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427469#M859274</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-11-22T10:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: awk or sed?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427470#M859275</link>
      <description>Thanks guys. The DBA's are happy and the day was saved!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Tue, 23 Nov 2004 08:23:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-sed/m-p/3427470#M859275</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-11-23T08:23:32Z</dc:date>
    </item>
  </channel>
</rss>

