<?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 split a large file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348781#M712787</link>
    <description>Scott --&lt;BR /&gt;&lt;BR /&gt;You can use awk as well to do something like this (although awk has a limit to the max fields per line that can sometimes mess you up).&lt;BR /&gt;&lt;BR /&gt;If you post the layout of the file (say a few sample lines) so I can see what the date string looks like, I could probably whip up a script in short order.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
    <pubDate>Wed, 04 Aug 2004 07:29:45 GMT</pubDate>
    <dc:creator>Kent Ostby</dc:creator>
    <dc:date>2004-08-04T07:29:45Z</dc:date>
    <item>
      <title>How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348772#M712778</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm looking for a way I can split an Oracle alert log based on month.  Currently I go into vi, create a new file with the data required, and then purge out of the current alert log.  I've currently got an alert log which is about 420Mb in size.  I would like to be able to delete all lines upto, say 1/8/04.&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;BR /&gt;&lt;BR /&gt;TIA,&lt;BR /&gt;Scott Taylor.</description>
      <pubDate>Wed, 04 Aug 2004 02:13:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348772#M712778</guid>
      <dc:creator>Unix Administrator_9</dc:creator>
      <dc:date>2004-08-04T02:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348773#M712779</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;for splitting a file based on expressions have a look at csplit. This will allow you to split the log file based on Dates in this file.&lt;BR /&gt;&lt;BR /&gt;For deleting up to an date i would use perl. this is flexible and capable of handling large files.&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Wed, 04 Aug 2004 02:22:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348773#M712779</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2004-08-04T02:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348774#M712780</link>
      <description>No straight way.&lt;BR /&gt;&lt;BR /&gt;Find out the line number from where you want to keep the alert log. Then use tail command&lt;BR /&gt;&lt;BR /&gt;tail -nline_number alert_log&amp;gt;new_alert_log&lt;BR /&gt;mv alert_log old_alert_log&lt;BR /&gt;mv new_alert_log alert_log&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 02:24:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348774#M712780</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-08-04T02:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348775#M712781</link>
      <description>Hi ,&lt;BR /&gt;  You can try 'csplit' with regexpression &lt;BR /&gt;You can scan for a regex then delete all lines preceding it ..&lt;BR /&gt;&lt;BR /&gt; csplit &lt;FILENAME&gt; /regex/+ &lt;BR /&gt;&lt;BR /&gt;See man csplit&lt;BR /&gt;HTH&lt;BR /&gt;Regards,&lt;BR /&gt;Ram.&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 04 Aug 2004 02:34:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348775#M712781</guid>
      <dc:creator>Ramalingam</dc:creator>
      <dc:date>2004-08-04T02:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348776#M712782</link>
      <description>Hi Scott,&lt;BR /&gt;&lt;BR /&gt;basically you can split up a large file with the equally named "split" command where you can determine the size of the pieces by your own.&lt;BR /&gt;In your special case you can use &lt;BR /&gt;vi &lt;FILENAME&gt;&lt;BR /&gt;:set number (show line numbering)&lt;BR /&gt;then search the first line you want to keep (eg. 120000)&lt;BR /&gt;then type 1G (top of file) and type 120000dd&lt;BR /&gt;this will delete the first 120000 lines and let you just the rest you want to keep.&lt;BR /&gt;Maybe there are better solutions, but at least it works :-)&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Franky&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 04 Aug 2004 02:35:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348776#M712782</guid>
      <dc:creator>Franky_1</dc:creator>
      <dc:date>2004-08-04T02:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348777#M712783</link>
      <description>Hi Scott&lt;BR /&gt;&lt;BR /&gt;open the log file using vi&lt;BR /&gt;:setnu &lt;BR /&gt;assign the numbers to each line, check for the lines upto 1/8/04 (note the line number)&lt;BR /&gt;&lt;BR /&gt;spilt -l &lt;LINE number=""&gt; &lt;FILENMAE&gt;&lt;BR /&gt;&lt;/FILENMAE&gt;&lt;/LINE&gt;</description>
      <pubDate>Wed, 04 Aug 2004 02:37:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348777#M712783</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2004-08-04T02:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348778#M712784</link>
      <description>hi, &lt;BR /&gt; &lt;BR /&gt;how to split the alert file by month?  Simple: start a cronjob each first or last minute of the month and move the file.&lt;BR /&gt;  &lt;BR /&gt;Personally I cut off the first n lines when the alert file exceeds a specified size.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Wed, 04 Aug 2004 03:33:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348778#M712784</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2004-08-04T03:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348779#M712785</link>
      <description>we can do it simply with sed as,&lt;BR /&gt;&lt;BR /&gt; To get this month informations,&lt;BR /&gt;&lt;BR /&gt; sed -e &lt;START line="" number=""&gt;,&lt;END line="" numer=""&gt;!d org-file &amp;gt;&amp;gt; backupfile&lt;BR /&gt;&lt;BR /&gt; To purge that details from original files,&lt;BR /&gt;&lt;BR /&gt; echo "`sed -e &lt;START line="" number=""&gt;,&lt;END line="" numer=""&gt;d org-file`" &amp;gt; org-file&lt;BR /&gt;&lt;BR /&gt;-- muthu --&lt;/END&gt;&lt;/START&gt;&lt;/END&gt;&lt;/START&gt;</description>
      <pubDate>Wed, 04 Aug 2004 05:13:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348779#M712785</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-08-04T05:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348780#M712786</link>
      <description>Hi Scott,&lt;BR /&gt;&lt;BR /&gt;for me cat (or more) works:&lt;BR /&gt;cat "alert log" | grep "string defining your month" &amp;gt; "new file"&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Volkmar</description>
      <pubDate>Wed, 04 Aug 2004 07:01:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348780#M712786</guid>
      <dc:creator>V. Nyga</dc:creator>
      <dc:date>2004-08-04T07:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348781#M712787</link>
      <description>Scott --&lt;BR /&gt;&lt;BR /&gt;You can use awk as well to do something like this (although awk has a limit to the max fields per line that can sometimes mess you up).&lt;BR /&gt;&lt;BR /&gt;If you post the layout of the file (say a few sample lines) so I can see what the date string looks like, I could probably whip up a script in short order.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 07:29:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348781#M712787</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-08-04T07:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348782#M712788</link>
      <description>Hmmm... this problem is much similar to:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=654588" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=654588&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Oracle alert files have times stamps like:&lt;BR /&gt;Fri Jun 25 14:19:13 2004&lt;BR /&gt;&lt;BR /&gt;I'd use a perl script (let's call it alert-by-month.pl) similar to&lt;BR /&gt;&lt;BR /&gt;if (/^\w+\s+(\w+)\s+\d+\s\d+:/) {&lt;BR /&gt;  if ($month ne $1) {&lt;BR /&gt;    $month = $1;&lt;BR /&gt;    open(M,"&amp;gt;alert_$month.log") or die;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;print M;&lt;BR /&gt;&lt;BR /&gt;So it looks for lines starting with a word [the day: \w+] followed by whitespace.&lt;BR /&gt;It remembers the next word in $1 [the month: (\w+)]&lt;BR /&gt;Then, to be sure it is a date stamp is looks for whitespace, numbers, whitespace, numbers, colon" : [day,hour,":"  : \s+\d+\s\d+: ]&lt;BR /&gt;&lt;BR /&gt;When it sees that, it compares the new month  (in $1) with the current month.&lt;BR /&gt;If it is a new month (like the first line!), then it makes that the current month and opens a new output file.&lt;BR /&gt;Finally it prints the line on the current file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now exectute with:&lt;BR /&gt;&lt;BR /&gt;perl -n alert-by-month.pl alert&lt;BR /&gt;&lt;BR /&gt;Good luck.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 09:37:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348782#M712788</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-08-04T09:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a large file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348783#M712789</link>
      <description>Scott -- using the data provided above, here is a solution.&lt;BR /&gt;&lt;BR /&gt;Create a script file called "do":&lt;BR /&gt;&lt;BR /&gt;echo MONTH $1 &amp;gt; .do1&lt;BR /&gt;cat $2 &amp;gt;&amp;gt; .do1&lt;BR /&gt;awk -f pull_month.awk &amp;lt; .do1 &amp;gt; .do3&lt;BR /&gt;mv .do2 archived_data.log&lt;BR /&gt;mv .do3 new_data.log&lt;BR /&gt;rm .do1&lt;BR /&gt;&lt;BR /&gt;Create an awk file called pull month :&lt;BR /&gt;&lt;BR /&gt;/^MONTH/ {targetmonth=$2;next;}&lt;BR /&gt;$2==targetmonth {print $0 &amp;gt; ".do2";next}&lt;BR /&gt;{print $0}&lt;BR /&gt;&lt;BR /&gt;Run it as:&lt;BR /&gt;&lt;BR /&gt;do Jun &lt;DATAFILE&gt;&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;do Jun usek&lt;BR /&gt;&lt;BR /&gt;usek contains:&lt;BR /&gt;Fri Jun asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Jun asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Jul asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Jul asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Aug asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Aug asdf asdf asdf asdfasdf&lt;BR /&gt;&lt;BR /&gt;after the run, archived_data_log contains:&lt;BR /&gt;&lt;BR /&gt;Fri Jun asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Jun asdf asdf asdf asdfasdf&lt;BR /&gt;&lt;BR /&gt;after the run, new_data_log contains:&lt;BR /&gt;Fri Jul asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Jul asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Aug asdf asdf asdf asdfasdf&lt;BR /&gt;Fri Aug asdf asdf asdf asdfasdf&lt;/DATAFILE&gt;</description>
      <pubDate>Wed, 04 Aug 2004 09:51:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-split-a-large-file/m-p/3348783#M712789</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-08-04T09:51:28Z</dc:date>
    </item>
  </channel>
</rss>

