<?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: grep command in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974111#M102091</link>
    <description>It looks like you're just removing the ADDRESS entry so pretty simple:&lt;BR /&gt;&lt;BR /&gt;grep -v "^ADDRESS:" filename&lt;BR /&gt;&lt;BR /&gt;-v prints all lines that don't match the pattern.&lt;BR /&gt;&lt;BR /&gt;^ designates the pattern should be at the beginning of the line.</description>
    <pubDate>Tue, 18 Apr 2006 09:35:55 GMT</pubDate>
    <dc:creator>Jeff_Traigle</dc:creator>
    <dc:date>2006-04-18T09:35:55Z</dc:date>
    <item>
      <title>grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974108#M102088</link>
      <description>I have a very large file that I wish to retrieve information from. The file contains data that can be repeated many times such as.&lt;BR /&gt;&lt;BR /&gt;USERNAME:john.doe&lt;BR /&gt;EMAIL:jonh.doe@yahoo.com&lt;BR /&gt;ADDRESS:somewhere&lt;BR /&gt;PHONENUMBER:12345&lt;BR /&gt;USERNAME:john.doe&lt;BR /&gt;EMAIL:jonh.doe@yahoo.com&lt;BR /&gt;ADDRESS:somewhere&lt;BR /&gt;PHONENUMBER:12345&lt;BR /&gt;&lt;BR /&gt;How do I grep the file so that the output will order the data in the following way:The output from grep should be:&lt;BR /&gt;1)USERNAME:john.doe&lt;BR /&gt;2)EMAIL:jonh.doe@yahoo.com&lt;BR /&gt;3)PHONENUMBER:12345&lt;BR /&gt;4)USERNAME:john.doe&lt;BR /&gt;5)EMAIL:jonh.doe@yahoo.com&lt;BR /&gt;6)PHONENUMBER:12345&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 09:31:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974108#M102088</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-18T09:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974109#M102089</link>
      <description>Use egrep:&lt;BR /&gt;&lt;BR /&gt;egrep "USERNAME|EMAIL|PHONE" file&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 09:34:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974109#M102089</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-04-18T09:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974110#M102090</link>
      <description>You don't. This isn't a job for grep. This is something that is best tackled with Perl, awk, or sed --- probably in that order of preference although for a novice awk is probably the easist to learn.</description>
      <pubDate>Tue, 18 Apr 2006 09:34:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974110#M102090</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-04-18T09:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974111#M102091</link>
      <description>It looks like you're just removing the ADDRESS entry so pretty simple:&lt;BR /&gt;&lt;BR /&gt;grep -v "^ADDRESS:" filename&lt;BR /&gt;&lt;BR /&gt;-v prints all lines that don't match the pattern.&lt;BR /&gt;&lt;BR /&gt;^ designates the pattern should be at the beginning of the line.</description>
      <pubDate>Tue, 18 Apr 2006 09:35:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974111#M102091</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-04-18T09:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974112#M102092</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Filters like 'grep' make one-pass through a file, and hence your output will occur in the order the matches appear in the input source.&lt;BR /&gt;&lt;BR /&gt;You can do:&lt;BR /&gt;&lt;BR /&gt;# grep -e USERNAME -e EMAIL -e PHONENUMBER filename&lt;BR /&gt;&lt;BR /&gt;...and you will see the order you posted as ouput if that's the sequential order of the input file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 09:39:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974112#M102092</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-18T09:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974113#M102093</link>
      <description>Wow! Thank you for all the replies. &lt;BR /&gt;&lt;BR /&gt;Is there any advantage from using grep -e to using egrep?&lt;BR /&gt;How do I number the lines followed by a bracket?</description>
      <pubDate>Tue, 18 Apr 2006 09:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974113#M102093</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-18T09:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974114#M102094</link>
      <description>Try,&lt;BR /&gt;&lt;BR /&gt;egrep "USERNAME|EMAIL|PHONENUMBER" &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Chan&lt;/FILENAME&gt;</description>
      <pubDate>Tue, 18 Apr 2006 09:45:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974114#M102094</guid>
      <dc:creator>Chan 007</dc:creator>
      <dc:date>2006-04-18T09:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974115#M102095</link>
      <description>Chan - that's exactly the same as what I already gave...no need to reiterate it...&lt;BR /&gt;&lt;BR /&gt;0 points for this reply.&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 18 Apr 2006 09:48:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974115#M102095</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-04-18T09:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974116#M102096</link>
      <description>INDEX=1&lt;BR /&gt;grep -v "^ADDRESS:" filename | while read LINE&lt;BR /&gt;do&lt;BR /&gt;echo "${INDEX})${LINE}"&lt;BR /&gt;INDEX=$((${INDEX}+1))&lt;BR /&gt;done</description>
      <pubDate>Tue, 18 Apr 2006 09:53:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974116#M102096</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-04-18T09:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974117#M102097</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;On HP-UX 'grep -E' (uppercase!) provides the same features as 'egrep'.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-60103/grep.1.html" target="_blank"&gt;http://www.docs.hp.com/en/B2355-60103/grep.1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Apr 2006 09:53:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974117#M102097</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-18T09:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974118#M102098</link>
      <description>Geoff, &lt;BR /&gt;&lt;BR /&gt;I opened two 3 sessions and assigning points on other threads and forget to submit this...&lt;BR /&gt;&lt;BR /&gt;I have not seen your reply..&lt;BR /&gt;I am fine with big fat "0"&lt;BR /&gt;&lt;BR /&gt;Chan</description>
      <pubDate>Tue, 18 Apr 2006 09:54:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974118#M102098</guid>
      <dc:creator>Chan 007</dc:creator>
      <dc:date>2006-04-18T09:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974119#M102099</link>
      <description>Hi Jeff T,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That was only a small portion of the file that I displayed. The file contains many more fields (that I dont know the names of)appart from ADDRESS that I dont need. I only know the names of the fields that I need hence deleting is not an option.&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2006 09:59:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974119#M102099</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-18T09:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974120#M102100</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Oh, and to show the linenumber on which the file matched, add the '-n' switch to your command"&lt;BR /&gt;&lt;BR /&gt;# grep -n -e USERNAME -e EMAIL -e PHONENUMBER&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Apr 2006 10:01:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974120#M102100</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-18T10:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974121#M102101</link>
      <description>Ah ok. egrep or grep -E is the way to go then. But the loop to prepend the numbers will be the same regardless.</description>
      <pubDate>Tue, 18 Apr 2006 10:02:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974121#M102101</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-04-18T10:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974122#M102102</link>
      <description>&amp;gt;&amp;gt;How do I number the lines followed by a bracket?&lt;BR /&gt;&lt;BR /&gt;Try this piplined construct...&lt;BR /&gt;&lt;BR /&gt;# grep -v '^ADDRESS' input_file | awk '{print NR")"$0}'&lt;BR /&gt;&lt;BR /&gt;hope it helps!</description>
      <pubDate>Tue, 18 Apr 2006 10:03:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974122#M102102</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-04-18T10:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974123#M102103</link>
      <description>Hi James&lt;BR /&gt;&lt;BR /&gt;Thank you for your help, but I dont need the line number that it matches. I just simply want to display a number for each line followed by a bracket.&lt;BR /&gt;&lt;BR /&gt;For example: with -n the match might be at line 55 but I would need to display the number of the line corresponding to the output screen</description>
      <pubDate>Tue, 18 Apr 2006 10:06:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974123#M102103</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-18T10:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974124#M102104</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;If I understand correctly, you want to number the lines of your screen output.  You can do:&lt;BR /&gt;&lt;BR /&gt;# grep -e USERNAME -e EMAIL -e PHONENUMBER filename | cat -n | more&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 18 Apr 2006 10:10:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974124#M102104</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-18T10:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974125#M102105</link>
      <description>Create a file with this content (ie: awk_script):&lt;BR /&gt;&lt;BR /&gt;BEGIN   {LINE=1}&lt;BR /&gt;!/ADDRESS/ {print LINE")" $0 ; LINE++}&lt;BR /&gt;&lt;BR /&gt;then:&lt;BR /&gt;&lt;BR /&gt;awk -f awk_script your_file&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Tue, 18 Apr 2006 10:14:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974125#M102105</guid>
      <dc:creator>Tiziano Contorno _</dc:creator>
      <dc:date>2006-04-18T10:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep command</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974126#M102106</link>
      <description>Thank you</description>
      <pubDate>Tue, 18 Apr 2006 10:46:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-command/m-p/4974126#M102106</guid>
      <dc:creator>Unix or Linux?</dc:creator>
      <dc:date>2006-04-18T10:46:37Z</dc:date>
    </item>
  </channel>
</rss>

