<?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 Difficult string extraction in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938405#M495308</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the format of my filename&lt;/P&gt;&lt;P&gt;aaaaaaaaaaaaaaaaaaaaaaa.bbb.cccccccccccccc.gz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to extract the 8 chars of the section just before .gz ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exemple:&lt;/P&gt;&lt;P&gt;SIEBER00_ora_38928476_1.aud.20170208163224.gz&lt;/P&gt;&lt;P&gt;=&amp;gt; 20170208&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;Den.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2017 15:40:04 GMT</pubDate>
    <dc:creator>SwissKnife</dc:creator>
    <dc:date>2017-02-08T15:40:04Z</dc:date>
    <item>
      <title>Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938405#M495308</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the format of my filename&lt;/P&gt;&lt;P&gt;aaaaaaaaaaaaaaaaaaaaaaa.bbb.cccccccccccccc.gz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to extract the 8 chars of the section just before .gz ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exemple:&lt;/P&gt;&lt;P&gt;SIEBER00_ora_38928476_1.aud.20170208163224.gz&lt;/P&gt;&lt;P&gt;=&amp;gt; 20170208&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;Den.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 15:40:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938405#M495308</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2017-02-08T15:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938412#M495309</link>
      <description>&lt;P&gt;If everything is the same format, then something like this may work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# export VAR1=SIEBER00_ora_38928476_1.aud.20170208163224.gz

# echo $VAR1
SIEBER00_ora_38928476_1.aud.20170208163224.gz

# echo $VAR1 | awk -F . '{print $3}' | cut -c 1-8
20170208&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Feb 2017 15:55:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938412#M495309</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2017-02-08T15:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938422#M495310</link>
      <description>&lt;P&gt;Hi, thank you for your answer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should have give more details. I can't check but perhaps I could have more . in the filename.&lt;/P&gt;&lt;P&gt;I missed to precise this and of course with your solution it works if format stays the same.&lt;/P&gt;&lt;P&gt;Is there a way to consider as a good mark the .gz and take the string before ? or it's too complicated ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Den&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 16:21:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938422#M495310</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2017-02-08T16:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938476#M495311</link>
      <description>&lt;P&gt;Try this. &amp;nbsp;This will print the 2nd to last field (the one before the .gz and cut out columns 1-8:&lt;/P&gt;&lt;PRE&gt;# echo $VAR1 | awk -F . '{print $(NF-1)}' | cut -c 1-8
20170208&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 19:15:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938476#M495311</guid>
      <dc:creator>PWallek</dc:creator>
      <dc:date>2017-02-08T19:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938488#M495312</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; Or, if "sed" is your only friend:&lt;BR /&gt;&lt;BR /&gt;pro3$ echo 'aaaa.aaa.bbb.c1c2c3c4c5c6c7.gz' | \&lt;BR /&gt;&amp;nbsp;sed -e 's/^.*\.\([^.]*\)\.gz$/\1/' -e 's/\(........\).*/\1/'&lt;BR /&gt;c1c2c3c4&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; The first expression looks for any characters at the begininng {^.*},&lt;BR /&gt;a dot {\.}, any non-dot characters {[^.]*}, and ".gz" at the end&lt;BR /&gt;{\.gz$}, and keeps the non-dot characters between those dots (the last&lt;BR /&gt;dot before ".gz", and the dot in ".gz").&amp;nbsp; The second expression keeps&lt;BR /&gt;the first eight characters from that result.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 20:10:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938488#M495312</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2017-02-08T20:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938693#M495313</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;perfect, thank you.&lt;/P&gt;&lt;P&gt;Kind regards, Den.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 09:59:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6938693#M495313</guid>
      <dc:creator>SwissKnife</dc:creator>
      <dc:date>2017-02-09T09:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Difficult string extraction</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6939383#M495314</link>
      <description>&lt;P&gt;You can of course program in awk:&lt;/P&gt;&lt;P&gt;echo "SIEBER00_ora_38928476_1.aud.20170208163224.gz" | awk '{print substr($0,&amp;nbsp;index($0, ".gz") - 8, 8)}'&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2017 02:24:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/difficult-string-extraction/m-p/6939383#M495314</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2017-02-12T02:24:36Z</dc:date>
    </item>
  </channel>
</rss>

