<?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 question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055511#M435693</link>
    <description>Thanks Patric , but a little change in requirement now : &lt;BR /&gt;&lt;BR /&gt;find . -type f output is : &lt;BR /&gt;&lt;BR /&gt;./shellscripts/A/SECQUERYuninstall&lt;BR /&gt;./shellscripts/A/B/2007.02_uninstall&lt;BR /&gt;./shellscripts/C/2007.03_install&lt;BR /&gt;./shellscripts/D/2007.03_uninstall&lt;BR /&gt;&lt;BR /&gt;and I want :&lt;BR /&gt;&lt;BR /&gt;shellscripts/A/SECQUERYuninstall&lt;BR /&gt;shellscripts/A/B/2007.02_uninstall&lt;BR /&gt;shellscripts/C/2007.03_install&lt;BR /&gt;shellscripts/D/2007.03_uninstall</description>
    <pubDate>Thu, 28 Jun 2007 11:37:40 GMT</pubDate>
    <dc:creator>Hunki</dc:creator>
    <dc:date>2007-06-28T11:37:40Z</dc:date>
    <item>
      <title>awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055508#M435690</link>
      <description>&lt;BR /&gt;find . -type f &lt;BR /&gt;&lt;BR /&gt;returns this :&lt;BR /&gt;./SECQUERYuninstall&lt;BR /&gt;./2007.02_uninstall&lt;BR /&gt;./2007.03_install&lt;BR /&gt;./2007.03_uninstall&lt;BR /&gt;&lt;BR /&gt;and I want to remove the initial ./ from the output and tried this : &lt;BR /&gt;&lt;BR /&gt;find . -type f |awk -F"./" '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;but it gave me the wrong output :&lt;BR /&gt;&lt;BR /&gt;/SECQUERYuninstall&lt;BR /&gt;02_uninstall&lt;BR /&gt;03_install&lt;BR /&gt;03_uninstall&lt;BR /&gt;&lt;BR /&gt;How shall i get the following output : &lt;BR /&gt;SECQUERYuninstall&lt;BR /&gt;2007.02_uninstall&lt;BR /&gt;2007.03_install&lt;BR /&gt;2007.03_uninstall</description>
      <pubDate>Thu, 28 Jun 2007 11:22:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055508#M435690</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-06-28T11:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055509#M435691</link>
      <description>Just omit the '.' in your '-F "./"&lt;BR /&gt;&lt;BR /&gt;# find . -type f | awk -F "/" '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jun 2007 11:30:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055509#M435691</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-06-28T11:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055510#M435692</link>
      <description>find . -type f | awk '{sub("^./","",$0); print $0}'&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jun 2007 11:32:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055510#M435692</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-06-28T11:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055511#M435693</link>
      <description>Thanks Patric , but a little change in requirement now : &lt;BR /&gt;&lt;BR /&gt;find . -type f output is : &lt;BR /&gt;&lt;BR /&gt;./shellscripts/A/SECQUERYuninstall&lt;BR /&gt;./shellscripts/A/B/2007.02_uninstall&lt;BR /&gt;./shellscripts/C/2007.03_install&lt;BR /&gt;./shellscripts/D/2007.03_uninstall&lt;BR /&gt;&lt;BR /&gt;and I want :&lt;BR /&gt;&lt;BR /&gt;shellscripts/A/SECQUERYuninstall&lt;BR /&gt;shellscripts/A/B/2007.02_uninstall&lt;BR /&gt;shellscripts/C/2007.03_install&lt;BR /&gt;shellscripts/D/2007.03_uninstall</description>
      <pubDate>Thu, 28 Jun 2007 11:37:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055511#M435693</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-06-28T11:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055512#M435694</link>
      <description>find . -type f | awk -F "/" '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;This approach only works in a special case; you said that you want to remove the INITIAL ./ from the string; consider the case of directories below the CWD.&lt;BR /&gt;&lt;BR /&gt;That is why sub("^./","",$0) is the better approach; it removes ONLY the initial ./ becase the search is anchored.</description>
      <pubDate>Thu, 28 Jun 2007 11:41:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055512#M435694</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-06-28T11:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055513#M435695</link>
      <description>Hi Hunki:&lt;BR /&gt;&lt;BR /&gt;# find . -type f | sed -e 's%^./%%'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 28 Jun 2007 11:43:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055513#M435695</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-06-28T11:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055514#M435696</link>
      <description>Thanks Clay but it gives me : &lt;BR /&gt;&lt;BR /&gt;awk: syntax error near line 1&lt;BR /&gt;awk: illegal statement near line 1</description>
      <pubDate>Thu, 28 Jun 2007 11:44:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055514#M435696</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-06-28T11:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055515#M435697</link>
      <description>I just cut-and-pasted Clay's solution into a terminal window and it worked fine for me.&lt;BR /&gt;&lt;BR /&gt;Perhahps you forgot a " somewhere?  &lt;BR /&gt;&lt;BR /&gt;It would help to see the exact command line you used, not just the errors.</description>
      <pubDate>Thu, 28 Jun 2007 11:48:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055515#M435697</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-06-28T11:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055516#M435698</link>
      <description>Then you have a personal problem because I just typed the command in and it produced exactly the desired output. Make sure that you do not confuse single and double quotes.</description>
      <pubDate>Thu, 28 Jun 2007 11:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055516#M435698</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-06-28T11:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055517#M435699</link>
      <description>Your original awk will work with a slight modification i.e.&lt;BR /&gt;&lt;BR /&gt;# find . -type f |awk -F"^./" '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;~hope it helps</description>
      <pubDate>Thu, 28 Jun 2007 11:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055517#M435699</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-06-28T11:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055518#M435700</link>
      <description>Thanks to Clay, JRF, Patrick.</description>
      <pubDate>Thu, 28 Jun 2007 13:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055518#M435700</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-06-28T13:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055519#M435701</link>
      <description>The correct solution was using sed to remove the leading "./".&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF: # find . -type f | sed -e 's%^./%%'&lt;BR /&gt;&lt;BR /&gt;The "." needs to be quoted otherwise it matches "A/".  But find probably won't return that.&lt;BR /&gt;# find . -type f | sed -e 's%^\./%%'&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Sandman: find . -type f |awk -F"^./" '{print $NF}'&lt;BR /&gt;&lt;BR /&gt;This needs to quote the "." too.&lt;BR /&gt;&lt;BR /&gt;Hmm, I had to do this to get it quoted if I left off the "^":&lt;BR /&gt;find . -type f | awk -F"\\\./" '{print $NF}'</description>
      <pubDate>Thu, 28 Jun 2007 21:21:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-question/m-p/5055519#M435701</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-28T21:21:27Z</dc:date>
    </item>
  </channel>
</rss>

