<?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 parsing in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224175#M170883</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar | awk -v file="\.[A-Z]+$" '{if($8 ~ file)print $8}' | while read FILE; do set file=`basename $FILE`;set dir= `dirname $FILE`;done;&lt;BR /&gt;&lt;BR /&gt;Is that what you were looking for?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Mar 2004 16:01:25 GMT</pubDate>
    <dc:creator>Michael Schulte zur Sur</dc:creator>
    <dc:date>2004-03-19T16:01:25Z</dc:date>
    <item>
      <title>awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224168#M170876</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I got a list of file like this:&lt;BR /&gt;&lt;BR /&gt;mcdbq/ABCDGEF.P&lt;BR /&gt;crtbn/GIFGEO.I&lt;BR /&gt;djgei/DKJFEO.VAR&lt;BR /&gt;rtbkdjf/fjiefj.p&lt;BR /&gt;rgmien/fjeijg.i&lt;BR /&gt;rteji/fjeij.d&lt;BR /&gt;&lt;BR /&gt;The .P can be whatever as long as it's in capital.  I am trying to get a listing of the files in capital only using this command:&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar |awk -v file="[A-Z]*\.[A-Z]*$" '{if($8 ~ file)print $8'&lt;BR /&gt;&lt;BR /&gt;It prints all the files (including the non-capital file); but if I do this:&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar |awk -v file="[A-Z]*\.P*$" '{if($8 ~ file)print $8'&lt;BR /&gt;&lt;BR /&gt;it only prints the .P file, which is not all the file I want&lt;BR /&gt;&lt;BR /&gt;I even use this command:&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar |awk -FS="/" -v file="[A-Z]*\.[A-Z]*$" '{if($8 ~ file)print $8'&lt;BR /&gt;&lt;BR /&gt;and there is no output at all.  Where did I got wrong?  Any help is appreciate.&lt;BR /&gt;&lt;BR /&gt;Thi&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 14:12:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224168#M170876</guid>
      <dc:creator>Thi Vu</dc:creator>
      <dc:date>2004-03-19T14:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224169#M170877</link>
      <description>Not AWK, but simple grep.&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar | grep -e "[A-Z]\$"&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Fri, 19 Mar 2004 14:27:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224169#M170877</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-03-19T14:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224170#M170878</link>
      <description>&lt;BR /&gt;Here is one way:&lt;BR /&gt;&lt;BR /&gt;awk '{n=split($0,p,"/");file=p[n]; if (file == toupper(file)) { print file}}' your-list-file&lt;BR /&gt;&lt;BR /&gt;split line into parts based on "/"&lt;BR /&gt;filename it the last part ("n")&lt;BR /&gt;print if filename equals uppercased filename.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 14:31:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224170#M170878</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-03-19T14:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224171#M170879</link>
      <description>give this a try&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar |awk -v file="\.[A-Z]+$" '{if($8 ~ file)print $8'&lt;BR /&gt;&lt;BR /&gt;use a + instead of *&lt;BR /&gt;* matches zero or more, as in it doesn't have to be there&lt;BR /&gt;+ matches one or more, there has to be at least one.</description>
      <pubDate>Fri, 19 Mar 2004 14:38:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224171#M170879</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-19T14:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224172#M170880</link>
      <description>Hi Anil and Curt,&lt;BR /&gt;&lt;BR /&gt;Your commands show everything (small letter files and capital letter files)&lt;BR /&gt;&lt;BR /&gt;Hein,&lt;BR /&gt;&lt;BR /&gt;Your command work, however thinking further down at the script I would like to know how do I go about if I want this:&lt;BR /&gt;&lt;BR /&gt;I have:  mcstm/ABDEGD.P&lt;BR /&gt;&lt;BR /&gt;I would like to assign file=ADBEGD.P and&lt;BR /&gt;dir=mcstm where I will call the variable file and dir several times somewhere else in the script.  Thanks&lt;BR /&gt;&lt;BR /&gt;Thi&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 14:56:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224172#M170880</guid>
      <dc:creator>Thi Vu</dc:creator>
      <dc:date>2004-03-19T14:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224173#M170881</link>
      <description>tar -tvf filename.tar | grep -e "[A-Z]\$"|awk -F "/" '{print $1, $2}'&lt;BR /&gt;&lt;BR /&gt;Anil&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 15:01:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224173#M170881</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-03-19T15:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224174#M170882</link>
      <description>The reason it is not doing what you want is the way "\" is being intrepetted by the shell and awk.&lt;BR /&gt; &lt;BR /&gt;Make the following change (double quotes to single and an extra "\")-&lt;BR /&gt; &lt;BR /&gt;tar -tvf filename.tar |awk -v file='[A-Z]*\\.[A-Z]*$' '{if($8 ~ file)print $8'&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar |awk -v file="[A-Z]*\.[A-Z]*$" '{if($8 ~ file)print $8'&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 15:35:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224174#M170882</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-03-19T15:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224175#M170883</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;tar -tvf filename.tar | awk -v file="\.[A-Z]+$" '{if($8 ~ file)print $8}' | while read FILE; do set file=`basename $FILE`;set dir= `dirname $FILE`;done;&lt;BR /&gt;&lt;BR /&gt;Is that what you were looking for?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 16:01:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224175#M170883</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-19T16:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: awk parsing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224176#M170884</link>
      <description>&lt;BR /&gt;&amp;gt; Your command work, however thinking further down at the script &lt;BR /&gt;&lt;BR /&gt;In the awk script or in a shell script that is using n awk command? Check out Micheals example of how to get awk output in a symbol. &lt;BR /&gt;In my example the symbols ar ether within the awk script for further processing.&lt;BR /&gt;Here are some more samples:&lt;BR /&gt;&lt;BR /&gt;awk:&lt;BR /&gt;&lt;BR /&gt;tar -tvf | awk '{if (match($8,/\/[A-Z\.]+$/)){ dir=substr($8,0,RSTART-1); file=substr($8,RSTART+1,999); print dir,file}}'&lt;BR /&gt;&lt;BR /&gt;perl:&lt;BR /&gt;&lt;BR /&gt;tar -tvf | 'if (/\s(.*)\/([A-Z\.]+)$/) { print "dir=$1, file=$2\n"}'&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 16:26:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-parsing/m-p/3224176#M170884</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-03-19T16:26:11Z</dc:date>
    </item>
  </channel>
</rss>

