Sponsored Content
Top Forums Shell Programming and Scripting splitting a large text file into paragraphs Post 302536003 by guruprasadpr on Sunday 3rd of July 2011 09:00:09 PM
Old 07-03-2011
Hi

Code:
awk '/Paragraph start/{if(NR!=1){for(i=0;i<j;i++)print a[i]>"file"k;j=0;k++;}a[j++]=$0;next}{a[j++]=$0;}END{for(i=0;i<j;i++)print a[i]>"file"k}' i=0 k=1  file

You will have output files created as file1, file2, file3 and so on.

Guru.
This User Gave Thanks to guruprasadpr For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Splitting a large log file

Okay, absolute newbie here... I'm on a Mac trying to split an almost 2 Gig log file on a Unix box into manageable chunks for my web-based log analysis tool. What do I need to do, what programs do I need to do it? All and any help appreciated/needed :-) Cheers (8 Replies)
Discussion started by: simmonet
8 Replies

2. Shell Programming and Scripting

Splitting large file into small files

Hi, I need to split a large file into small files based on a string. At different palces in the large I have the string ^Job. I need to split the file into different files starting from ^Job to the last character before the next ^Job. Also all the small files should be automatically named.... (4 Replies)
Discussion started by: dncs
4 Replies

3. UNIX for Dummies Questions & Answers

splitting the large file into smaller files

hi all im new to this forum..excuse me if anythng wrong. I have a file containing 600 MB data in that. when i do parse the data in perl program im getting out of memory error. so iam planning to split the file into smaller files and process one by one. can any one tell me what is the code... (1 Reply)
Discussion started by: vsnreddy
1 Replies

4. Shell Programming and Scripting

Help with splitting a large text file into smaller ones

Hi Everyone, I am using a centos 5.2 server as an sflow log collector on my network. Currently I am using inmons free sflowtool to collect the packets sent by my switches. I have a bash script running on an infinate loop to stop and start the log collection at set intervals - currently one... (2 Replies)
Discussion started by: lord_butler
2 Replies

5. Shell Programming and Scripting

Splitting a large file, split command will not do.

Hello Everyone, I have a large file that needs to be split into many seperate files, however the text in between the blank lines need to be intact. The file looks like SomeText SomeText SomeText SomeOtherText SomeOtherText .... Since the number of lines of text are different for... (3 Replies)
Discussion started by: jwillis0720
3 Replies

6. Shell Programming and Scripting

awk - splitting 1 large file into multiple based on same key records

Hello gurus, I am new to "awk" and trying to break a large file having 4 million records into several output files each having half million but at the same time I want to keep the similar key records in the same output file, not to exist accross the files. e.g. my data is like: Row_Num,... (6 Replies)
Discussion started by: kam66
6 Replies

7. Shell Programming and Scripting

Problem with splitting large file based on pattern

Hi Experts, I have to split huge file based on the pattern to create smaller files. The pattern which is expected in the file is: Master..... First... second.... second... third.. third... Master... First.. second... third... Master... First... second.. second.. second..... (2 Replies)
Discussion started by: saisanthi
2 Replies

8. Shell Programming and Scripting

Splitting large file and renaming based on field

I am trying to update an older program on a small cluster. It uses individual files to send jobs to each node. However the newer database comes as one large file, containing over 10,000 records. I therefore need to split this file. It looks like this: HMMER3/b NAME 1-cysPrx_C ACC ... (2 Replies)
Discussion started by: fozrun
2 Replies

9. Shell Programming and Scripting

Help with Splitting a Large XML file based on size AND tags

Hi All, This is my first post here. Hoping to share and gain knowledge from this great forum !!!! I've scanned this forum before posting my problem here, but I'm afraid I couldn't find any thread that addresses this exact problem. I'm trying to split a large XML file (with multiple tag... (7 Replies)
Discussion started by: Aviktheory11
7 Replies

10. Shell Programming and Scripting

Splitting a large file as per date

Hi, I need a suggestion for an issue in UNIX file. I have a log file in my system where data is appending everyday and as a consequence the file is increasing heavily everyday. Now I need a logic to split this file daily basis and remove the files more than 15 days. Request you to... (3 Replies)
Discussion started by: bhaski2012
3 Replies
Text::Lorem(3pm)					User Contributed Perl Documentation					  Text::Lorem(3pm)

NAME
Text::Lorem - Generate random Latin looking text SYNOPSIS
use Text::Lorem; my $text = Text::Lorem->new(); # Generate a string of text with 5 words $words = $text->words(5); # Generate a string of text with 2 sentences $sentences = $text->sentences(2); # Generate 3 paragraphs $paragraphs = $text->paragraphs(3); DESCRIPTION
Often when developing a website or other application it's important to have placeholders for content. This module generates prescribed amounts of fake Latin text. CONSTRUCTOR
"new()" The default constructor, "new()" takes no arguments and returns a Text::Lorem object. METHODS
"words( INTEGER )" Returns INTEGER fake Latin words. "sentences( INTEGER )" Returns INTEGER sentences in fake Latin. "paragraphs( INTEGER )" Returns INTEGER paragraphs of fake Latin text. THANKS
Thanks to the guys who pushed me off the cliff called comfort and into the scary world of Perl: James Duncan, Leon Brocard. AUTHOR
Adeola Awoyemi (adeola@fotango.com) SEE ALSO
L<WWW::Lipsum> and L<http://lipsum.com/> COPYRIGHT
Copyright 2003 Fotango Ltd. All rights reserved. <http://opensource.fotango.com/> This software is released under the same license as Perl itself. perl v5.10.1 2011-01-05 Text::Lorem(3pm)
All times are GMT -4. The time now is 01:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy