in reply to strict

Ooooohkay, quick and dirty, how I would start: no error checking,
and clumsy, but maybe an Idea:
#!/usr/bin/perl -w use strict; my $UserID="Unknown"; my %UserData; while (<>) { next unless (/\w/io); #Skip empty lines if (/^(\S+)\s+(\S+)\s*=\s*(\S+)/io) # Match <NewUser> <Tag>=<Data> to + $1,$2,$3 { $UserID=$1; #Set $UserID to current user $UserData{$UserID}{$2}=$3; #Assign the data to the user in a + hash next; #Next line, this was a special ca +se }; s/\s+|\,//iog; #Remove spaces, and comma's (God +forgive me for that one) my ($Key,$Val)=split /=/; #Get the Key, and Data $UserData{$UserID}{$Key}=$Val; #Assign it to the current user }; #Just some printing of the data. foreach my $User (keys %UserData) { print "User: $User\n"; foreach my $Data (keys %{$UserData{$User}}) { print "\t\"$Data\":\t$UserData{$User}{$Data}\n"; }; };
With your example data this gives me:
choas@<Censored to protect myself from my employer>$ ./lal inpt User: test2user "Password": "Testpassword" "Framed-Protocol": PPP "Ascend-Idle-Limit": 600 User: testuser "User-Service": Framed-user "Authentication-Type": Unix-PW "Framed-Address": 222.222.222.222 "Framed-Protocol": PPP "Ascend-Metric": 3 "Ascend-Route-IP": Route-IP-Yes "Framed-Netmask": 255.255.255.255 "Ascend-Idle-Limit": 600

Hope I gave you an Idea

GrtZ!

p.s. yeah, most of my quick 'n dirty progs are called 'lal' ;))