![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Convert Epoch time format to normal date time format in the same file | rk4k | Shell Programming and Scripting | 3 | 11-19-2008 10:04 PM |
| To convert multi format file to a readable ascii format | gaur.deepti | UNIX for Dummies Questions & Answers | 5 | 03-25-2008 03:03 PM |
| Convert UTF8 Format file to ANSI format | rajreddy | UNIX for Dummies Questions & Answers | 9 | 05-25-2007 08:26 AM |
| Convert UTF8 Format file to ANSI format | rajreddy | UNIX for Advanced & Expert Users | 1 | 05-24-2007 06:40 AM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 11:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
convert files into csv format using perl
Hi all perl gurus,
I need your help to get the desired output in perl. I have a file which has text in it in the format Connection request start timestamp = 12/08/2008 00:58:36.956700 Connect request completion timestamp = 12/08/2008 00:58:36.959729 Application idle time = 1 minute 8 seconds CONNECT Authorization ID = PDPD240 Client login ID = pdpd240 Configuration NNAME of client = sppwd518 but i want it to be displayed in the format. 12/08/2008 00:58:36.956700,12/08/2008 00:58:36.959729,1 minute 8 seconds i.e. the left most things to be in a comma seperated value. The script should take the file name as argument.for eg perl scriptname <filename> even a snippett of the code would be fine for me to atleast have an idea how to go ahead Thanks |
|
||||
|
Im not a perl programmer and i've not tested this. but basicly it should work
my @start; my @complete; my @time; my $filename=@ARGV[0]; open( FILE, "< $filename" ) or die "Can't open $filename : $!"; while( <FILE> ) { chomp; @start = split(/=/) if /start/ ; @complete = split(/=/) if /completion/; @time = split(/=/) if /idle time/; print "@start[1] @complete[1] @time[1] \n" if /NNAME/; } |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|