<?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 grep problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044013#M433446</link>
    <description>&lt;BR /&gt;I am doing a " ls -ltr |grep -v "*.gz" " - so that I cant view gzipped files but they still show up . How to get a listing without the gzipped file.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;hunki</description>
    <pubDate>Wed, 02 May 2007 14:46:30 GMT</pubDate>
    <dc:creator>Hunki</dc:creator>
    <dc:date>2007-05-02T14:46:30Z</dc:date>
    <item>
      <title>grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044013#M433446</link>
      <description>&lt;BR /&gt;I am doing a " ls -ltr |grep -v "*.gz" " - so that I cant view gzipped files but they still show up . How to get a listing without the gzipped file.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;hunki</description>
      <pubDate>Wed, 02 May 2007 14:46:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044013#M433446</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T14:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044014#M433447</link>
      <description>ls -lrt  |grep -v "\.gz$"</description>
      <pubDate>Wed, 02 May 2007 14:54:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044014#M433447</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2007-05-02T14:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044015#M433448</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# ls -ltr |grep -v -F .gz&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 02 May 2007 14:55:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044015#M433448</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-02T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044016#M433449</link>
      <description>remove the " "&lt;BR /&gt;&lt;BR /&gt;ls -ltr |grep -v *.gz</description>
      <pubDate>Wed, 02 May 2007 14:58:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044016#M433449</guid>
      <dc:creator>Aussan</dc:creator>
      <dc:date>2007-05-02T14:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044017#M433450</link>
      <description>The whole point of having the grep problem solved was to have the the "0502" passed as a variable to the script.&lt;BR /&gt;&lt;BR /&gt;I have reached a point where I get the following output , what I need to know is how to pass the 0502 as a value to a variable.&lt;BR /&gt;&lt;BR /&gt;## ls -ltr |grep -v -F .gz |awk '{print $9}' |awk -F"." '{print $3}'&lt;BR /&gt;&lt;BR /&gt;0502&lt;BR /&gt;0502</description>
      <pubDate>Wed, 02 May 2007 15:40:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044017#M433450</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T15:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044018#M433451</link>
      <description>Could you provide a sample or see if the following works for you:&lt;BR /&gt;&lt;BR /&gt;# VAR=$(ls -ltr |grep -v -F .gz |awk '{print $9}' |awk -F"." '{print $3}')&lt;BR /&gt;&lt;BR /&gt;pass VAR to your script named "myscript" as follows:&lt;BR /&gt;&lt;BR /&gt;# ./myscript $VAR&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 15:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044018#M433451</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-02T15:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044019#M433452</link>
      <description>after passing on I am getting two 0502's &lt;BR /&gt;&lt;BR /&gt;echo $VAR&lt;BR /&gt;0502 0502&lt;BR /&gt;&lt;BR /&gt;I just want one - 0502 passed as Variable.</description>
      <pubDate>Wed, 02 May 2007 15:45:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044019#M433452</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T15:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044020#M433453</link>
      <description>Piping to sort for uniqueness should do the trick for you:&lt;BR /&gt;&lt;BR /&gt;# VAR=$(ls -ltr |grep -v -F .gz |awk '{print $9}' |awk -F"." '{print $3}' | sort -u)&lt;BR /&gt;&lt;BR /&gt;~cheers</description>
      <pubDate>Wed, 02 May 2007 15:49:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044020#M433453</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-02T15:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044021#M433454</link>
      <description>Shalom hunki,&lt;BR /&gt;&lt;BR /&gt;Two awk's is likely resulting in double output.&lt;BR /&gt;&lt;BR /&gt;VAR=$(ls -ltr |grep -v -F .gz |awk '{print $9}' |awk -F"." '{print $3}')&lt;BR /&gt;&lt;BR /&gt;Try it with 1.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 02 May 2007 15:55:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044021#M433454</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-05-02T15:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044022#M433455</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I think you can optimize something like this:&lt;BR /&gt;&lt;BR /&gt;# ls -ltr |awk '$NF!~/.gz/ {n=split($NF,a,/\./);if (n==3) {print a[2]}}'&lt;BR /&gt;&lt;BR /&gt;Hence if you had a file named "/tmp/myfile.123.log" you would be returned "123".&lt;BR /&gt;&lt;BR /&gt;Anytime you 'grep' and pipe to 'awk' you are adding an extra process that 'awk' can accomodate!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 02 May 2007 16:13:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044022#M433455</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-02T16:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044023#M433456</link>
      <description>&lt;BR /&gt;One more problem : &lt;BR /&gt;&lt;BR /&gt;When I am doing a "mv filename.$VAR filename" it says &lt;BR /&gt;&lt;BR /&gt;mv: filename not found&lt;BR /&gt;&lt;BR /&gt;where VAR is the 0502.&lt;BR /&gt;&lt;BR /&gt;there is a file by the name filename.0502 that exists in the directory but mv does not work when I supply the variable. Also when I do a echo $VAR , I do get the 0502 value for it.&lt;BR /&gt;&lt;BR /&gt;Please suggest whats the problem.&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 16:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044023#M433456</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T16:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044024#M433457</link>
      <description>Does filename have abcd.xyz.0502 format when you specify it as an argument to the mv(1) command?</description>
      <pubDate>Wed, 02 May 2007 16:54:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044024#M433457</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-02T16:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044025#M433458</link>
      <description>Yes . infact filename.rar.0502</description>
      <pubDate>Wed, 02 May 2007 16:57:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044025#M433458</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T16:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044026#M433459</link>
      <description>Most likely you have invisible characters in your filename; post the output of:&lt;BR /&gt;&lt;BR /&gt;# ls -1 *05* | cat -ve</description>
      <pubDate>Wed, 02 May 2007 17:03:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044026#M433459</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-02T17:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044027#M433460</link>
      <description>Yes it does have non printing characters :&lt;BR /&gt;&lt;BR /&gt;filename.rar.0502$&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2007 17:05:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044027#M433460</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T17:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044028#M433461</link>
      <description>Please post the code snippet to troubleshoot this issue.&lt;BR /&gt;&lt;BR /&gt;~thanks</description>
      <pubDate>Wed, 02 May 2007 17:08:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044028#M433461</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-05-02T17:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044029#M433462</link>
      <description>Here you go ...</description>
      <pubDate>Wed, 02 May 2007 17:13:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044029#M433462</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-02T17:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044030#M433463</link>
      <description>Hi Hunki:&lt;BR /&gt;&lt;BR /&gt;You need to source (read) your profile by doing:&lt;BR /&gt;&lt;BR /&gt;. $HOME/.profile&lt;BR /&gt;&lt;BR /&gt;In this fashion, you will propagate any environmental variables form your profile into your script.&lt;BR /&gt;&lt;BR /&gt;By the way, when using 'cat -ev' the "$" character is a newline character.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 02 May 2007 17:53:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044030#M433463</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-02T17:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044031#M433464</link>
      <description>Since you are using a real shell, why don't you remove the grep -v and replace by:&lt;BR /&gt;$ ls -ltr !(*.gz)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Sandman:  Piping to sort for uniqueness should do the trick for you:&lt;BR /&gt;&lt;BR /&gt;It seems this is correct.  There seems to be N files that have X.y.date, there X varies.  So the initial script will return the same one twice.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF: You need to source (read) your profile by doing:&lt;BR /&gt;&lt;BR /&gt;While this is true, why would you ever need to source your .profile except if you are in a remsh or crontab script?</description>
      <pubDate>Thu, 03 May 2007 00:56:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044031#M433464</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-03T00:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: grep problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044032#M433465</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;But my original problem got left out ... &lt;BR /&gt;&lt;BR /&gt;mv: filename not found&lt;BR /&gt;&lt;BR /&gt;how to sort that out , please suggest.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;</description>
      <pubDate>Thu, 03 May 2007 07:44:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/grep-problem/m-p/5044032#M433465</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-05-03T07:44:59Z</dc:date>
    </item>
  </channel>
</rss>

