Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl #Parses web log and reformats opendir(DIR, 'c:\perl\test'); ##If . is used and .pl is in the same d +ir as files it works! @files = readdir(DIR); close(DIR); foreach $file (@files) { $name = $file; @filename = split (/\./, $name); # open (MYFILE, ">myfile.txt"); open( THEFILE,$file ) ; @theList = <THEFILE>; close( THEFILE ); foreach( @theList ) { s/\/uid=/,/; s/LDAP:\/\///; s/ou=//g; s/o=//; @theLine = split( /\s*,\s*/ ); print "\"$theLine[0]\",\"$theL +ine[1]\",$theLine[2]\",\"$theLine[3]\",\"$theLine[4]\",\"$theLine[5]\ +",\"$theLine[6],\"$filename[0]\",\"$filename[1]\",$theLine[7] \n"; } } exit( 0 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Directory Stuff
by Jenda (Abbot) on Apr 18, 2003 at 14:41 UTC | |
|
Re: Directory Stuff
by dws (Chancellor) on Apr 18, 2003 at 15:49 UTC |