<?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: Delete in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268430#M11997</link>
    <description>My bad&lt;BR /&gt;I want to delete 1st 2 lines and 1st empty space and last empty space in a text file&lt;BR /&gt;in a script.&lt;BR /&gt;&lt;BR /&gt; ABCDEFG&lt;BR /&gt; -------&lt;BR /&gt; AANHITW&lt;BR /&gt; ABEAWGI&lt;BR /&gt; ABEGIGI&lt;BR /&gt;&lt;BR /&gt;i dont need 1st 2 lines and remove spaces before and after each line.&lt;BR /&gt;does &lt;BR /&gt;sed /^\ d works and how&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
    <pubDate>Wed, 05 May 2004 11:29:39 GMT</pubDate>
    <dc:creator>Vanquish</dc:creator>
    <dc:date>2004-05-05T11:29:39Z</dc:date>
    <item>
      <title>Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268429#M11996</link>
      <description />
      <pubDate>Wed, 05 May 2004 11:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268429#M11996</guid>
      <dc:creator>Vanquish</dc:creator>
      <dc:date>2004-05-05T11:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268430#M11997</link>
      <description>My bad&lt;BR /&gt;I want to delete 1st 2 lines and 1st empty space and last empty space in a text file&lt;BR /&gt;in a script.&lt;BR /&gt;&lt;BR /&gt; ABCDEFG&lt;BR /&gt; -------&lt;BR /&gt; AANHITW&lt;BR /&gt; ABEAWGI&lt;BR /&gt; ABEGIGI&lt;BR /&gt;&lt;BR /&gt;i dont need 1st 2 lines and remove spaces before and after each line.&lt;BR /&gt;does &lt;BR /&gt;sed /^\ d works and how&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 05 May 2004 11:29:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268430#M11997</guid>
      <dc:creator>Vanquish</dc:creator>
      <dc:date>2004-05-05T11:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268431#M11998</link>
      <description>So let me get this straight.  You've got a file with contents like:&lt;BR /&gt;&lt;BR /&gt;+-- start here --+&lt;BR /&gt;LINE_OF_JUNK&lt;BR /&gt;---------&lt;BR /&gt;keepthis&lt;BR /&gt;keepthis&lt;BR /&gt;keepthis&lt;BR /&gt;&lt;BR /&gt;+-- end here --+&lt;BR /&gt;&lt;BR /&gt;You want to get rid of everything before, and including the '-----' line, and any blank lines.  Yes?</description>
      <pubDate>Wed, 05 May 2004 19:32:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268431#M11998</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-05-05T19:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268432#M11999</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;sed '1,2d;s/ //g'&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;sed -n 's/ //g;3,$p'&lt;BR /&gt;&lt;BR /&gt;thx.&lt;BR /&gt;</description>
      <pubDate>Wed, 05 May 2004 23:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268432#M11999</guid>
      <dc:creator>Kiyoshi Miyake</dc:creator>
      <dc:date>2004-05-05T23:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268433#M12000</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;awk '{&lt;BR /&gt;   if (NR&amp;gt;2) {&lt;BR /&gt;      for (i=1;i&amp;lt;=NF;i++)&lt;BR /&gt;         printf($i)&lt;BR /&gt;      printf("\n")&lt;BR /&gt;   }&lt;BR /&gt;}' text_file&lt;BR /&gt;&lt;BR /&gt;Or the pipe format:&lt;BR /&gt;&lt;BR /&gt;cat text_file | awk '{&lt;BR /&gt;   if (NR&amp;gt;2) {&lt;BR /&gt;      for (i=1;i&amp;lt;=NF;i++)&lt;BR /&gt;         printf($i)&lt;BR /&gt;      printf("\n")&lt;BR /&gt;   }&lt;BR /&gt;}' &lt;BR /&gt;&lt;BR /&gt;Or the script format, you must create a file (for example script.awk) with this content:&lt;BR /&gt;&lt;BR /&gt;---- script.awk ----&lt;BR /&gt;{&lt;BR /&gt;   if (NR&amp;gt;2) {&lt;BR /&gt;      for (i=1;i&amp;lt;=NF;i++)&lt;BR /&gt;         printf($i)&lt;BR /&gt;      printf("\n")&lt;BR /&gt;   }&lt;BR /&gt;}&lt;BR /&gt;------ end script.awk ----------&lt;BR /&gt;&lt;BR /&gt;Now you can do:&lt;BR /&gt;awk -f script.awk text_file&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Thu, 06 May 2004 11:52:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268433#M12000</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2004-05-06T11:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268434#M12001</link>
      <description>Hi,&lt;BR /&gt;One appointment, with the awk solution, all spaces before and after the lines are removed but also removes all spaces between fields in the same line.&lt;BR /&gt;&lt;BR /&gt;Frank.</description>
      <pubDate>Thu, 06 May 2004 12:39:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268434#M12001</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2004-05-06T12:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268435#M12002</link>
      <description>&lt;BR /&gt;Any spaces in the text posted to the forum get massacred. So please use a (.txt) file attachement to display an example of the expected input AND the desired output.&lt;BR /&gt;&lt;BR /&gt;In perl the solution might be:&lt;BR /&gt;&lt;BR /&gt;perl -e '&amp;lt;&amp;gt;;&amp;lt;&amp;gt;;while(&amp;lt;&amp;gt;){s/^\s+//;s/\s+$/\n/;print unless ($_ eq ""&lt;BR /&gt;)}' &amp;lt; old-file &amp;gt; new-file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;in english:&lt;BR /&gt;read and forget a line&lt;BR /&gt;read and forget an other line&lt;BR /&gt;loop while lines&lt;BR /&gt;replace leading spaces with nothing&lt;BR /&gt;replace trailing spaces with a newline&lt;BR /&gt;print unless it is an empty line&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Be sure to reply with attached test if this is not what you wanted.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 15:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268435#M12002</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-05-07T15:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268436#M12003</link>
      <description>vi filename&lt;BR /&gt;dd&lt;BR /&gt;dd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;:wq!&lt;BR /&gt; &lt;BR /&gt;:)</description>
      <pubDate>Fri, 07 May 2004 22:28:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268436#M12003</guid>
      <dc:creator>generic_1</dc:creator>
      <dc:date>2004-05-07T22:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268437#M12004</link>
      <description>Jeff, my "d" finger hurt just reading that!&lt;BR /&gt;&lt;BR /&gt;:)</description>
      <pubDate>Tue, 11 May 2004 10:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/delete/m-p/3268437#M12004</guid>
      <dc:creator>Paul Cross_1</dc:creator>
      <dc:date>2004-05-11T10:45:30Z</dc:date>
    </item>
  </channel>
</rss>

