<?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 view the commented line in vi file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797565#M641503</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Instead of *two* processes as in:&lt;BR /&gt;&lt;BR /&gt;# awk NF /etc/sudoers | grep -v ^[[:space:]]*#&lt;BR /&gt;&lt;BR /&gt;...do it all with *one* process:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF &amp;amp;&amp;amp; ! /^[[:space:]]*#/' /etc/sudoers&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Sun, 12 Jun 2011 11:50:28 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2011-06-12T11:50:28Z</dc:date>
    <item>
      <title>how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797549#M641487</link>
      <description>pls find the below vi file.&lt;BR /&gt;&lt;BR /&gt;example:&lt;BR /&gt;vi sudoers&lt;BR /&gt;1.# Cmnd alias specification&lt;BR /&gt;2.STORE  /usr/sbin/frestore, /usr/sbin/backup&lt;BR /&gt;3.UMOUNT = /usr/sbin/umount&lt;BR /&gt;4.MOUNT = /usr/sbin/mount&lt;BR /&gt;5.# Host alias specification&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the above example i want to view the line number 2,3,4 .because i want to see the uncommented line in the vi file&lt;BR /&gt;&lt;BR /&gt;pls help me</description>
      <pubDate>Fri, 10 Jun 2011 02:37:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797549#M641487</guid>
      <dc:creator>rajesh73</dc:creator>
      <dc:date>2011-06-10T02:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797550#M641488</link>
      <description>&lt;!--!*#--&gt;&amp;gt; how to view the commented line in vi file&lt;BR /&gt;&lt;BR /&gt;What is "vi file"?  A plain-old text file&lt;BR /&gt;which was created by "vi"?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] i want to view [...]&lt;BR /&gt;&lt;BR /&gt;Can't you see them now?&lt;BR /&gt;&lt;BR /&gt;Do you mean something like this?:&lt;BR /&gt;&lt;BR /&gt;alp$ grep -v '^#' 1483561.txt&lt;BR /&gt;STORE /usr/sbin/frestore, /usr/sbin/backup&lt;BR /&gt;UMOUNT = /usr/sbin/umount&lt;BR /&gt;MOUNT = /usr/sbin/mount&lt;BR /&gt;&lt;BR /&gt;      man grep</description>
      <pubDate>Fri, 10 Jun 2011 03:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797550#M641488</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-10T03:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797551#M641489</link>
      <description>hi thanks for your replay .&lt;BR /&gt;&lt;BR /&gt;my request is &lt;BR /&gt;&lt;BR /&gt;in this sudoers file ,i want to view only uncommneted line,  how to view</description>
      <pubDate>Fri, 10 Jun 2011 04:36:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797551#M641489</guid>
      <dc:creator>rajesh73</dc:creator>
      <dc:date>2011-06-10T04:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797552#M641490</link>
      <description>#grep -v '#' /etc/sudoers</description>
      <pubDate>Fri, 10 Jun 2011 04:44:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797552#M641490</guid>
      <dc:creator>g3jza</dc:creator>
      <dc:date>2011-06-10T04:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797553#M641491</link>
      <description>thanks for replay.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jun 2011 04:55:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797553#M641491</guid>
      <dc:creator>rajesh73</dc:creator>
      <dc:date>2011-06-10T04:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797554#M641492</link>
      <description>&lt;!--!*#--&gt;&amp;gt; #grep -v '#' [...]&lt;BR /&gt;&lt;BR /&gt;Ok, if you want to reject any line with a "#"&lt;BR /&gt;in it anywhere.  '^#' is a little more&lt;BR /&gt;selective.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] only uncommneted line [...]&lt;BR /&gt;&lt;BR /&gt;Define "uncommneted line".  Is&lt;BR /&gt;      /util/search.sh '###' &amp;gt; /tmp/fred.out&lt;BR /&gt;an "uncommneted line"?&lt;BR /&gt;&lt;BR /&gt;Everything's complicated, and a vague problem&lt;BR /&gt;statement can lead to a sloppy "solution".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Jun 10, 2011 04:42:59 GMT   8 pts&lt;BR /&gt;&lt;BR /&gt;What?  Did I use the wrong file name?</description>
      <pubDate>Fri, 10 Jun 2011 05:46:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797554#M641492</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-10T05:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797555#M641493</link>
      <description>Steven:&lt;BR /&gt;I haven't seen any standard unix configuration files, which would NOT have the '#' at the beginning of the line :) , that's why I'm always using -v '#' .&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jun 2011 06:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797555#M641493</guid>
      <dc:creator>g3jza</dc:creator>
      <dc:date>2011-06-10T06:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797556#M641494</link>
      <description>&lt;!--!*#--&gt;&amp;gt; I haven't seen any standard unix&lt;BR /&gt;&amp;gt; configuration files, which would NOT have&lt;BR /&gt;&amp;gt; the '#' at the beginning of the line :) ,&lt;BR /&gt;&amp;gt; that's why I'm always using -v '#' .&lt;BR /&gt;&lt;BR /&gt;The original question said "vi file"&lt;BR /&gt;(whatever that means), not "standard unix&lt;BR /&gt;configuration files".  However, let's look at&lt;BR /&gt;the example of "sudoers".  I'm not a big sudo&lt;BR /&gt;user, so I know nothing, but a quick Google&lt;BR /&gt;search found some documentation which&lt;BR /&gt;suggests that "sudoers" might contain&lt;BR /&gt;notation like, say,&lt;BR /&gt;      #include /etc/sudoers.local&lt;BR /&gt;which would make this task a little more&lt;BR /&gt;chancy.  Also, it appears that one is allowed&lt;BR /&gt;to use "#" to add a comment to the end of a&lt;BR /&gt;normal line, and it seems to be a part of the&lt;BR /&gt;"sudoers" syntax, as in "#uid" or "%#gid".&lt;BR /&gt;&lt;BR /&gt;So, discarding any line which contains "#"&lt;BR /&gt;anywhere would seem in this example to risk&lt;BR /&gt;losing considerable useful information.&lt;BR /&gt;&lt;BR /&gt;If you would like to expand "^#" to include&lt;BR /&gt;white space before "#" (and/or "#include" at&lt;BR /&gt;the beginning of a line), then I wouldn't&lt;BR /&gt;complain.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Everything's complicated, [...]&lt;BR /&gt;&lt;BR /&gt;A simple solution to a problem is normally&lt;BR /&gt;better than a more complicated one, unless&lt;BR /&gt;that simpler "solution" doesn't actually&lt;BR /&gt;solve the problem.  (Of course, having a&lt;BR /&gt;clear and complete definition of the problem&lt;BR /&gt;is helpful, but this is often difficult to&lt;BR /&gt;obtain.)</description>
      <pubDate>Fri, 10 Jun 2011 11:01:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797556#M641494</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-10T11:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797557#M641495</link>
      <description>saludos,&lt;BR /&gt;&lt;BR /&gt;Do a grep -v for all lines starts with # which can be identified using "^#" in the output of the cat command.&lt;BR /&gt;&lt;BR /&gt;cat /etc/sudoers |grep -v "^#"&lt;BR /&gt;&lt;BR /&gt;All lines starts with a # will be eliminated in the output.&lt;BR /&gt;&lt;BR /&gt;todo lo mejor&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Jun 2011 13:14:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797557#M641495</guid>
      <dc:creator>點燃</dc:creator>
      <dc:date>2011-06-10T13:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797558#M641496</link>
      <description>&lt;!--!*#--&gt;&amp;gt; cat /etc/sudoers |grep -v "^#"&lt;BR /&gt;&lt;BR /&gt;Why didn't _I_ think of that?  No, wait...&lt;BR /&gt;&lt;BR /&gt;Note that the "cat" is not needed.</description>
      <pubDate>Fri, 10 Jun 2011 16:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797558#M641496</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-10T16:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797559#M641497</link>
      <description>#grep -v '#' /etc/sudoers</description>
      <pubDate>Sat, 11 Jun 2011 04:07:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797559#M641497</guid>
      <dc:creator>Hiren N Dave</dc:creator>
      <dc:date>2011-06-11T04:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797560#M641498</link>
      <description>&lt;!--!*#--&gt;Hiren N Dave&amp;gt;  #grep -v '#' /etc/sudoers&lt;BR /&gt;&lt;BR /&gt;Have you considered the benefits of reading&lt;BR /&gt;the previous replies before duplicating one&lt;BR /&gt;of them?</description>
      <pubDate>Sat, 11 Jun 2011 05:44:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797560#M641498</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-11T05:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797561#M641499</link>
      <description>Yes, you are right. The credit should go to g3jza.</description>
      <pubDate>Sat, 11 Jun 2011 06:54:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797561#M641499</guid>
      <dc:creator>Hiren N Dave</dc:creator>
      <dc:date>2011-06-11T06:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797562#M641500</link>
      <description>well, actually the credit should go to Steven, he got the most complete solution</description>
      <pubDate>Sat, 11 Jun 2011 09:11:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797562#M641500</guid>
      <dc:creator>g3jza</dc:creator>
      <dc:date>2011-06-11T09:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797563#M641501</link>
      <description>This is probably the most complete and simplest answer:&lt;BR /&gt; &lt;BR /&gt;awk NF /etc/sudoers | grep -v ^[[:space:]]*#&lt;BR /&gt; &lt;BR /&gt;This removes all blank or space-only lines and any line that has # as the first non-space character on the line. (non-space really means white space which includes tabs).&lt;BR /&gt; &lt;BR /&gt;Since it is very common to want non-comment lines filtered out of config files, I wrote the NOcomment script (attached).</description>
      <pubDate>Sat, 11 Jun 2011 22:46:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797563#M641501</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2011-06-11T22:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797564#M641502</link>
      <description>&lt;!--!*#--&gt;&amp;gt; This is probably the most complete and&lt;BR /&gt;&amp;gt; simplest answer:&lt;BR /&gt;&amp;gt; [...]&lt;BR /&gt;&lt;BR /&gt;Define "probably" (or "simplest").&lt;BR /&gt;&lt;BR /&gt;With one program ("grep") instead of two:&lt;BR /&gt;&lt;BR /&gt;alp$ grep -E -v '^[[:space:]]*#|^[[:space:]]*$' 1483561.txt&lt;BR /&gt;STORE /usr/sbin/frestore, /usr/sbin/backup&lt;BR /&gt;UMOUNT = /usr/sbin/umount&lt;BR /&gt;MOUNT = /usr/sbin/mount&lt;BR /&gt;&lt;BR /&gt;alp$ cat 1483561.txt&lt;BR /&gt;# Cmnd alias specification&lt;BR /&gt;STORE /usr/sbin/frestore, /usr/sbin/backup&lt;BR /&gt;UMOUNT = /usr/sbin/umount&lt;BR /&gt;&lt;BR /&gt;   # Comment with leading space.&lt;BR /&gt;MOUNT = /usr/sbin/mount&lt;BR /&gt;        &lt;BR /&gt;# Host alias specification</description>
      <pubDate>Sun, 12 Jun 2011 03:38:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797564#M641502</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-06-12T03:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797565#M641503</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Instead of *two* processes as in:&lt;BR /&gt;&lt;BR /&gt;# awk NF /etc/sudoers | grep -v ^[[:space:]]*#&lt;BR /&gt;&lt;BR /&gt;...do it all with *one* process:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF &amp;amp;&amp;amp; ! /^[[:space:]]*#/' /etc/sudoers&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 12 Jun 2011 11:50:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797565#M641503</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-12T11:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to view the commented line in vi file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797566#M641504</link>
      <description>Or create an alias so you have a new command:&lt;BR /&gt; &lt;BR /&gt;alias NOcomment="awk 'NF &amp;amp;&amp;amp; ! /^[[:space:]]*#/'"&lt;BR /&gt; &lt;BR /&gt;Works with one or more files as well as stdin.&lt;BR /&gt;Thanks JRF</description>
      <pubDate>Sun, 12 Jun 2011 19:28:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-view-the-commented-line-in-vi-file/m-p/4797566#M641504</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2011-06-12T19:28:46Z</dc:date>
    </item>
  </channel>
</rss>

