<?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: How to get only the line indicated with &amp;quot;grep&amp;quot; ... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748866#M656533</link>
    <description>On second though another approach might be ;&lt;BR /&gt;# ls -lR /usr/ |grep 'company1$'</description>
    <pubDate>Tue, 08 Feb 2011 12:27:08 GMT</pubDate>
    <dc:creator>Hakki Aydin Ucar</dc:creator>
    <dc:date>2011-02-08T12:27:08Z</dc:date>
    <item>
      <title>How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748856#M656523</link>
      <description>Hi .. how can i get only "/usr" if there are directories containing the same word as follows?&lt;BR /&gt;i am in / ... into / there are the following directories and fiiles:&lt;BR /&gt;dr-xrwxrwx   5 bin  bin /usr&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user1&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user2/b.txt&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user3/a.txt&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user4&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user5&lt;BR /&gt;&lt;BR /&gt;if i list /usr i get:&lt;BR /&gt;i am under /&lt;BR /&gt;ls -lrt | grep /usr .... i get all the lines that contains "/usr"  ...&lt;BR /&gt;dr-xrwxrwx   5 bin  bin /usr&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user1&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user2/b.txt&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/user3/a.txt&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user4&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user5&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but i only want to get theline that only contains "/usr" as follows:&lt;BR /&gt;dr-xrwxrwx   5 bin  bin /usr&lt;BR /&gt;&lt;BR /&gt;and .. how about if i only want to get the line that says:  /usr/company1/&lt;BR /&gt;&lt;BR /&gt;ls -lrt | grep "/usr/company1/"&lt;BR /&gt;i only want to get:&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/&lt;BR /&gt;&lt;BR /&gt;and not all the lines below ...&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user4&lt;BR /&gt;drwxrwxrwx   5 bin  bin /usr/company1/user5&lt;BR /&gt;&lt;BR /&gt;please your help, thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Sat, 05 Feb 2011 06:27:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748856#M656523</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-05T06:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748857#M656524</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;For your case just try adding a blank space before last double quotes:&lt;BR /&gt;#ls -lrt | grep "/usr/company1/&lt;A blank="" space="" target="_blank"&gt;"&lt;BR /&gt;&lt;BR /&gt;Rgds.&lt;/A&gt;</description>
      <pubDate>Sat, 05 Feb 2011 07:02:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748857#M656524</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2011-02-05T07:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748858#M656525</link>
      <description>&amp;gt;how can I get only "/usr" if there are directories containing the same word as follows?&lt;BR /&gt;&lt;BR /&gt;If you are looking for directories, you are going about this wrong.  Use -d to only list the one directory: ll -d /usr /usr/company&lt;BR /&gt;&lt;BR /&gt;But if you are practicing grep, you can look into -w or -x.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Jose: For your case just try adding a blank space&lt;BR /&gt;&lt;BR /&gt;That's not likely to work since there isn't a blank at the end of the line.  You can use "$" as the end of line anchor instead:&lt;BR /&gt;ls -lrt | grep "/usr/company1/$"</description>
      <pubDate>Sat, 05 Feb 2011 08:36:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748858#M656525</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-02-05T08:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748859#M656526</link>
      <description>thanks for answering ..&lt;BR /&gt;never mind if it is a directory or file .. i mean, i am doing a loop and there i do not specify if it is a directory or not ... i only get the line with that word "/usr/company1/" the problem here is i get the 5 lines below when i use "grep", i forget tell you i have files under those directories ...&lt;BR /&gt;&lt;BR /&gt;drwxrwxrwx 5 bin bin /usr/company1/&lt;BR /&gt;drwxrwxrwx 5 bin bin /usr/company1/user4&lt;BR /&gt;drwxrwxrwx 5 bin bin /usr/company1/user5&lt;BR /&gt;-rwxrwxrwx 5 bin bin /usr/company1/user5/file1&lt;BR /&gt;-rwxrwxrwx 5 bin bin /usr/company1/user5/file2&lt;BR /&gt;&lt;BR /&gt;if i want to get the line with "/usr/company1/" i only want to get &lt;BR /&gt;drwxrwxrwx 5 bin bin /usr/company1/ and not the 5 lines .. how can i do that? what command or parameter can i use?&lt;BR /&gt;&lt;BR /&gt;thanks in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 06 Feb 2011 14:01:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748859#M656526</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-06T14:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748860#M656527</link>
      <description>&amp;gt;never mind if it is a directory or file&lt;BR /&gt;&lt;BR /&gt;That's important.  If you don't want to expand directories, add that -d.  (It doesn't change how non-directories are displayed.)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;how can I do that? what command or parameter can I use?&lt;BR /&gt;&lt;BR /&gt;As I said above, adding -d would be easier.  Or you can use "$" in the grep.</description>
      <pubDate>Sun, 06 Feb 2011 15:08:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748860#M656527</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-02-06T15:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748861#M656528</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;It is worth your noting that in addition to limiting matches to a string that is anchored (pinned) to the end of a line, you can also match a string only if it is anchored to the beginning of a line.&lt;BR /&gt;&lt;BR /&gt;The '$' as the last character of a regular expression anchors the match to the end of a line.&lt;BR /&gt;&lt;BR /&gt;The '^' as the first character of a regular expresson anchors the match to the beginning of a line.&lt;BR /&gt;&lt;BR /&gt;Hence, as noted, to match '/usr/company/1' in your example, you could do:&lt;BR /&gt;&lt;BR /&gt;# ... grep /usr/company/1$&lt;BR /&gt;&lt;BR /&gt;If you had a 'ls -l' listing of both files and directories, you could match only files, for example, by doing:&lt;BR /&gt;&lt;BR /&gt;# ls -l | grep ^-&lt;BR /&gt;&lt;BR /&gt;...since files are listing on a line that begins with a '-'.   Correspondingly, since symbolic links begin with 'l', this would find those:&lt;BR /&gt;&lt;BR /&gt;# ls -l | grep ^l&lt;BR /&gt;&lt;BR /&gt;For much much more about regular expressions, see the manpages for 'regexp(5)'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 06 Feb 2011 15:48:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748861#M656528</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-06T15:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748862#M656529</link>
      <description>Hi manuales,&lt;BR /&gt;&lt;BR /&gt;long story short:&lt;BR /&gt;use&lt;BR /&gt;ls -lrt ... | grep '/usr/company1/$'&lt;BR /&gt;&lt;BR /&gt;or if there may or may not a "/" at the end of your string&lt;BR /&gt;ls -lrt ... | grep '/usr/company1/*$'&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Sun, 06 Feb 2011 18:05:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748862#M656529</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2011-02-06T18:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748863#M656530</link>
      <description>Hi .. it works:&lt;BR /&gt;ls -lrt ... | grep '/usr/company1/*$'&lt;BR /&gt;&lt;BR /&gt;thanks a lot.</description>
      <pubDate>Mon, 07 Feb 2011 23:06:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748863#M656530</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-07T23:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748864#M656531</link>
      <description>I am not sure it is working in that way ? OR I misunderstood totaly what you are looking for:&lt;BR /&gt;I mean:&lt;BR /&gt;# ls -lrt ... | grep '/usr/local/*$'   &lt;BR /&gt;... not found&lt;BR /&gt;# ls -lrt  | grep '/usr/local/*$' &lt;BR /&gt;&lt;BR /&gt;but;&lt;BR /&gt;&lt;BR /&gt;# cd&lt;BR /&gt;# ls -lR  | grep "/usr/local/*"&lt;BR /&gt;./usr/local/include:&lt;BR /&gt;./usr/local/lib:&lt;BR /&gt;./usr/local/man:&lt;BR /&gt;./usr/local/man/de:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(you need to put company1 instead of local)&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Feb 2011 07:44:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748864#M656531</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2011-02-08T07:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748865#M656532</link>
      <description># ls -ald /usr/company1</description>
      <pubDate>Tue, 08 Feb 2011 08:13:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748865#M656532</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2011-02-08T08:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748866#M656533</link>
      <description>On second though another approach might be ;&lt;BR /&gt;# ls -lR /usr/ |grep 'company1$'</description>
      <pubDate>Tue, 08 Feb 2011 12:27:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748866#M656533</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2011-02-08T12:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748867#M656534</link>
      <description>THANKS ALL FOR YOUR ANSWERS ...&lt;BR /&gt;One more question ...&lt;BR /&gt;how can i do this using a variable&lt;BR /&gt;&lt;BR /&gt;valor="/home/direct1"&lt;BR /&gt;is this correct?&lt;BR /&gt;ls -lrt | grep "$valor$" &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Feb 2011 23:45:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748867#M656534</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-11T23:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get only the line indicated with "grep" ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748868#M656535</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Better form, which avoids ambiguity, is to enclose the variable name with curly braces when performing parameter substitution:&lt;BR /&gt;&lt;BR /&gt;# ls -lrt | grep "${valor}$"&lt;BR /&gt;&lt;BR /&gt;The braces are required when parameter is followed by a letter, digit, or underscore that should not be interpreted as part of its name or when a named parameter is subscripted.&lt;BR /&gt;&lt;BR /&gt;Good habits avoid surprises.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 12 Feb 2011 00:13:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-only-the-line-indicated-with-quot-grep-quot/m-p/4748868#M656535</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-12T00:13:11Z</dc:date>
    </item>
  </channel>
</rss>

