Afficher un message
Vieux 16/03/2008, 18h29   #2
Michael Heiming
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: split text file chunks by regex line

In comp.unix.shell nobody@cares <superdu>:
> Hi,
> Being a beginner in Linux I hit this problem which I know can be
> solved by scripting. I recovered a bunch of files from a disk crash
> that contains all my emails but they were in 2 mb chunks and in no
> particular demarkation. So i combined them into one huge file.


No backup and using doze?

> To break them into smaller messages I need to search for a line say
> "---Next_Part ...blah bla ----
> an take everything between the two lines and create the new text
> file as 00000????.txt. Thats all that need to be done in order for


awk 'BEGIN{RS="---Next_Part"}{print $0 > "mail"NR}' infile

Something in the lines should do the trick.

Good luck

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 14: sounds like a Windows problem, try calling
Microsoft support
  Réponse avec citation
 
Page generated in 0,05416 seconds with 9 queries