Discussion: V-Card split script
Afficher un message
Vieux 13/03/2008, 21h44   #3
andyhaupt@netscape.net
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: V-Card split script

Try awk.

vcf.awk:
/END:/ { # end of vcard
vcard = vcard $0;
print vcard >filename;
vcard = "";
next;
}
{ # append line to vcard
vcard = vcard $0 "\n";
}
/^N:/ { # N:LastName;FirstName;;;
n = split($0,a,":");
n = split(a[2],b,";");
filename = b[1] "-" b[2] ".vcf";
}

and then
awk -f vcf.awk vcffile

On 13 Mrz., 21:09, ChrisOD <ch...@dont.send.me.any.email> wrote:
> I have a 13Mb vcf file and would love to split this into it's
> component parts.
>
> i.e. I want to have a seperate .vcf file for each addressee.
>
> For those script experts that are unfamiliar with v-cards
> it is a text file that looks like this.
>
> BEGIN:VCARD
> VERSION:3.0
> N:LastName;FirstName;;;
> FN:FirstName LastName
> ...
> ...
> END:VCARD
> BEGIN:VCARD
> ...
>
> I'd like to have the seperate .vcf files named on the N field
> with a syntax like: LastName-FirstName.vcf
>
> Hope someone can give some hints to a script newbie.
>
> Chris


rgds
andreas
  Réponse avec citation
 
Page generated in 0,04839 seconds with 9 queries