<?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: script problem in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959642#M77048</link>
    <description>Here are a couple quick-and-dirty methods:&lt;BR /&gt;&lt;BR /&gt;$ cat &lt;FILE&gt; | grep -n ""&lt;BR /&gt;1:myline1&lt;BR /&gt;2:myline2&lt;BR /&gt;3:myline3&lt;BR /&gt;&lt;BR /&gt;$ cat -n &lt;FILE&gt;&lt;BR /&gt;     1  myline1&lt;BR /&gt;     2  myline2&lt;BR /&gt;     3  myline3&lt;BR /&gt;&lt;BR /&gt;-Jared&lt;/FILE&gt;&lt;/FILE&gt;</description>
    <pubDate>Sat, 26 Apr 2003 04:04:26 GMT</pubDate>
    <dc:creator>Jared Middleton</dc:creator>
    <dc:date>2003-04-26T04:04:26Z</dc:date>
    <item>
      <title>script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959638#M77044</link>
      <description>how can i put a number in front of each line in a given file?</description>
      <pubDate>Fri, 25 Apr 2003 16:01:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959638#M77044</guid>
      <dc:creator>neocosmic</dc:creator>
      <dc:date>2003-04-25T16:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959639#M77045</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;when you are usign "vi" editor, you can use the "set number" command to numer each line of your file.&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Fri, 25 Apr 2003 16:44:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959639#M77045</guid>
      <dc:creator>LucianoCarvalho</dc:creator>
      <dc:date>2003-04-25T16:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959640#M77046</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here are some ways to do it in sed:&lt;BR /&gt;&lt;BR /&gt;# number each line of a file (simple left alignment). Using a tab (see&lt;BR /&gt; # note on '\t' at end of file) instead of space will preserve margins.&lt;BR /&gt; sed = filename | sed 'N;s/\n/\t/'&lt;BR /&gt;&lt;BR /&gt; # number each line of a file (number on left, right-aligned)&lt;BR /&gt; sed = filename | sed 'N; s/^/     /; s/ *\(.\{6,\}\)\n/\1  /'&lt;BR /&gt;&lt;BR /&gt; # number each line of file, but only print numbers if line is not blank&lt;BR /&gt; sed '/./=' filename | sed '/./N; s/\n/ /'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Courtesy of Eric Pement's wonderful One Liners for Sed.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Apr 2003 16:45:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959640#M77046</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-04-25T16:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959641#M77047</link>
      <description>If you mean while you are vi'ing the file you can hit escape then ":" and type "set nu"  This will number each line.  if you want to add actual numbers into the file you can do this:&lt;BR /&gt;&lt;BR /&gt;count=1&lt;BR /&gt;cat file |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;echo $count $line&lt;BR /&gt;((count=$count+1))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if you want to save this output you can send it to another file and rename it back to the original if you so wish.</description>
      <pubDate>Fri, 25 Apr 2003 17:24:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959641#M77047</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-04-25T17:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959642#M77048</link>
      <description>Here are a couple quick-and-dirty methods:&lt;BR /&gt;&lt;BR /&gt;$ cat &lt;FILE&gt; | grep -n ""&lt;BR /&gt;1:myline1&lt;BR /&gt;2:myline2&lt;BR /&gt;3:myline3&lt;BR /&gt;&lt;BR /&gt;$ cat -n &lt;FILE&gt;&lt;BR /&gt;     1  myline1&lt;BR /&gt;     2  myline2&lt;BR /&gt;     3  myline3&lt;BR /&gt;&lt;BR /&gt;-Jared&lt;/FILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Sat, 26 Apr 2003 04:04:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959642#M77048</guid>
      <dc:creator>Jared Middleton</dc:creator>
      <dc:date>2003-04-26T04:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959643#M77049</link>
      <description>you can do it with &lt;BR /&gt;&lt;BR /&gt;pr -n &lt;BR /&gt;&lt;BR /&gt;too&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vitaly</description>
      <pubDate>Sun, 27 Apr 2003 05:58:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959643#M77049</guid>
      <dc:creator>Vitaly Karasik_1</dc:creator>
      <dc:date>2003-04-27T05:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: script problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959644#M77050</link>
      <description>two more ways from my collegaus:&lt;BR /&gt;&lt;BR /&gt;1) Tom Rosenfeld &lt;BR /&gt;And don't forget nl(1) the Number Line utility written for just this problem! try&lt;BR /&gt;    $ nl files...&lt;BR /&gt;or see the man page for all the options.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2) Jonathan rodin&lt;BR /&gt;Just in case people get bored of using all the other ways, there's also:&lt;BR /&gt; &lt;BR /&gt;    less -N&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 28 Apr 2003 04:56:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-problem/m-p/2959644#M77050</guid>
      <dc:creator>Vitaly Karasik_1</dc:creator>
      <dc:date>2003-04-28T04:56:01Z</dc:date>
    </item>
  </channel>
</rss>

