
jeffersno1
Novice
Dec 5, 2011, 8:30 PM
Post #1 of 7
(4687 views)
|
perl one liner - need some advice
|
Can't Post
|
|
Hi All, Wondered if someone could help me here with a one liner for perl??? What id like to do is run a perl command against a 55GB file (1mnths logs) to substitute 1 character "/" for "," log file snippet 2011-10-01 00:00:00.861,RADIUS-IU,447555552255,11.91.11.173,apn.net.uk 2011-10-01 00:00:00.863,CCR-U,4,,PGHLD01-1,447555555555,122.22.222.222,apn.net.uk,domestic 2011-10-01 00:00:00.863,DIA_CCR_U,133.11.114.215,447555555555,2202,4115788/78923,IR0,5242880, 2011-10-01 00:00:00.675,DIA_CCR_T,119.11.137.209,447111111116,2200,0/0,IR2,-, 2011-10-01 00:00:00.675,DIA_CCR_T,111.11.137.209,447111111116,2202,422/482,IR2,-, 2011-10-01 00:00:00.693,DIA_CCR_U,111.105.88.11,447912345678,2202,4114441/79882,IR0,5242880, 2011-10-01 00:00:00.773,DIA_CCR_U,11.111.85.88,447512345678,2202,141/173,IR1,10485760, 2011-10-01 00:00:00.634,RADIUS-Stop,447787878787,111.11.131.119,apn.net.uk 2011-10-01 00:00:00.648,logoutByIpAddress,447133333396,111.91.111.109,ok what id like to do is substitute the "/" for a comma but only on lines where there is a DIA_CCR. Does anyone know if this is possible from the command line?? Also the reason id like to use perl or sed is because its not so CPU or memory hungry and this is being run against a live server... I've already used some one liners to substitute the date format, the reason I'm doing this is so i can load it into SQL and run queries against the data. Here are a few commands I've already ran on the file
sed 's/:/./3' file1 > file2 perl -pe 's/_/ /' file1 > file2 any help appreciated. Many thanks Jeffers
|