![]() |
|
|
|
|
|||||||
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Enterprise Unix Roundup: The Ghost of Unix Future - Server Watch | iBot | UNIX and Linux RSS News | 0 | 12-19-2007 08:20 AM |
| Running UNIX commands remotely in Windows box from Unix box – avoid entering password | D.kalpana | UNIX for Dummies Questions & Answers | 1 | 04-20-2007 02:24 AM |
| FTP script for sending a file from one unix directory to another unix server director | raja_1234 | Shell Programming and Scripting | 1 | 11-30-2006 03:57 AM |
| Unix Sco Open Server, Windows Computers Problem Access Unix Shared Files Help!!!!! | haggo | Filesystems, Disks and Memory | 2 | 08-23-2006 08:39 AM |
| Unix History Question: Why are filenames/dirnames case sentsitive in Unix? | deckard | UNIX for Dummies Questions & Answers | 3 | 03-26-2005 09:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
UNIX awk help
I am new to UNIX and I need a sample awk or sed program to solve the following problem.
I have a file with the following format. The file is comma delimited. Each record has header information followed by looping detailed information. In addition the detailed information will vary based on a value found in the header information. For example if the header information has a value of 48 then the detail will have 48 sets of detail information. A set of detailed information is a set of 3 fields. The other value is 24, so the detail will either have 48 sets or 24 sets of detail. What I want to do is replace the delimiter after the value 48 or 24 and around each triplete of information. I highligted the areas in bold where I want to change the comma to a semi colon. Sample of current record: MEPMD01,19970819,Sensus,SDGE,SDGE,,200705221435,1888961,OK,E,KWH,1,00000015,48,200705210715,R 00 40,2.0000,200705210730,R 00 40,1.0000,200705210745,R 00 40,2.0000,200705210800,R 00 40,1.0000,200705210815,R 00 40,2.0000,200705210830,R 00 40,2.0000,200705210845,R 00 40,1.0000,200705210900,R 00 40,2.0000,200705210915,R 00 40,2.0000,200705210930,R 00 40,1.0000,200705210945,R 00 40,2.0000,200705211000,R 00 40,1.0000,200705211015,R 00 40,2.0000,200705211030,R 00 40,2.0000,200705211045,R 00 40,1.0000,200705211100,R 00 40,2.0000,200705211115,R 00 40,2.0000,200705211130,R 00 40,1.0000,200705211145,R 00 40,2.0000,200705211200,R 00 40,1.0000,200705211215,R 00 40,2.0000,200705211230,R 00 40,2.0000,200705211245,R 00 40,1.0000,200705211300,R 00 40,2.0000,200705211315,R 00 40,2.0000,200705211330,R 00 40,1.0000,200705211345,R 00 40,2.0000,200705211400,R 00 40,1.0000,200705211415,R 00 40,1.0000,200705211430,R 00 40,2.0000,200705211445,R 00 40,1.0000,200705211500,R 00 40,1.0000,200705211515,R 00 40,1.0000,200705211530,R 00 40,1.0000,200705211545,R 00 40,1.0000,200705211600,R 00 40,1.0000,200705211615,R 00 40,1.0000,200705211630,R 00 40,1.0000,200705211645,R 00 40,1.0000,200705211700,R 00 40,1.0000,200705211715,R 00 40,1.0000,200705211730,R 00 40,1.0000,200705211745,R 00 40,1.0000,200705211800,R 00 40,1.0000,200705211815,R 00 40,1.0000,200705211830,R 00 40,1.0000,200705211845,R 00 40,1.0000,200705211900,R 00 40,1.0000 Roy Ayala |
| Forum Sponsor | ||
|
|