Hi Neale,

It's an awful thing to do since the CSV "column names" are "embedded" in 
the original file and fields are non positional, and some records have 
more fields than others...

I'm answering (late, since I haven't read the list for quite a few days), 
cause I made a perl script some time ago to handle something quite 
similar.

I had to convert an LDIFF (LDAP Interchange File Format) file (with all 
objects of the same objectclass) to a table with the attribute names as 
column headings.

I made a "quick and VERY dirty" perl script to handle it. It does a 
couple of very nasty things but gets the job done.

It will need modifications to handle the radius accounting format... It 
doesn't handle the timestamp line, I don't think it handles whitespace 
before the attribute name and (this is the worst part) it builds the 
table in memory as an array of hashes...

I had only 10,000 records so it wasn't a problem, but radius accounting 
logs can get really large...

I did it this way to be able to construct the heading line on top, since 
I couldn't know all of the attribute names until I process all of the 
records... however it shouldn't be very hard to modify it to generate the 
records to a file on the fly while generating the column headings array, 
close that file, write that array to another file and append the first 
file to the second one.

If you are interested, I can send you the script... with ABSOLUTELY NO 
GUARANTEES (other than it worked once for LDIF :-)...

El 9 Apr 2001, a las 19:39, Hugh Irvine escribió:

> 
> Hello Neale -
> 
> Have you had a look in the goodies directory to see if there is anything there?
> 
> Otherwise I am sure someone on the list has done this at lease once.
> 
> regards
> 
> Hugh
> 
> 
> At 13:45 +1000 01/4/9, Neale Banks wrote:
> >G'day Hugh,
> >
> >On Fri, 6 Apr 2001, Hugh Irvine wrote:
> >
> >>  Hello Neale -
> >>
> >>  On Thursday 05 April 2001 10:15, Neale Banks wrote:
> >>  > Greetings all,
> >>  >
> >>  > Not exclusively Radiator-relevant, but probably RADIUS+Perl relevant...
> >>  >
> >>  > Does anyone have any pointer to anything to convert flat-file accounting
> >>  > records to comma-separated format?
> >>
> >>  You can use the AcctLogFileName and AcctLogFileFormat to specify any format
> >>  you wish. Sections 6.15.4 and 6.15.5 in the Radiator 2.18 reference manual.
> >>
> >>  > Alternatively, any other solutions to the need to tabulate a user's STOP
> >>  > records to run some elementary stats over their sessions times and
> >>  > disconnect reasons?
> >>
> >>  It would probably be simpler to write the data to an SQL database directly
> >>  and use an SQL report externally.
> >
> >Whilst these would both be good solutions for new records, unfortunately
> >my current "challenge" is to extract some statistics from historical data
> >which is in traditional flat-file accounting records.
> >
> >I'd be grateful of any suggestions anyone has regarding this.
> >
> >Thanks,
> >Neale.
> 
> -- 
> 
> NB: I am travelling this week, so there may be delays in our correspondence.
> 
> Radiator: the most portable, flexible and configurable RADIUS server
> anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
> Platypus, Freeside, Interbiller, TACACS+, PAM, external, etc, etc.
> Available on Unix, Linux, FreeBSD, Windows 95/98/2000, NT, MacOS X.
> 
> ===
> Archive at http://www.starport.net/~radiator/
> Announcements on [EMAIL PROTECTED]
> To unsubscribe, email '[EMAIL PROTECTED]' with
> 'unsubscribe radiator' in the body of the message.



===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to