![]() |
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 |
| UNIX Desktop for Dummies Questions & Answers Discuss UNIX and Linux user interfaces like GNOME, KDE, CDE, and Open Office here. All UNIX and Linux Newbies Welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script required to get a required info from file. Pls. help me. | ntgobinath | Shell Programming and Scripting | 2 | 05-31-2008 08:34 AM |
| Formatting | mirusnet | Shell Programming and Scripting | 3 | 01-06-2008 11:38 PM |
| Formatting using awk | cdunavent | Shell Programming and Scripting | 2 | 03-18-2003 02:09 PM |
| formatting | tamemi | UNIX for Dummies Questions & Answers | 5 | 07-21-2002 09:03 AM |
| formatting | xeron | UNIX for Dummies Questions & Answers | 5 | 03-20-2002 11:33 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Help required with formatting
I would appreciate any help (sed / awk / perl) on the following question. I have the file in the following format. Note that the records are separated by the line that starts with the word "TRACE".I want the 5th and 6th values on the line starting with "TRACE" to be repeated down the file until the next record is hit (a line starting with the word TRACE). If this is my input file, then please have a look at the bottom i.e the output that I want using perl or awk.
INPUT ======= TRACE mrjn05 6487 4922 358666.00 3154690.00 4 8 4 12068.6 12 12067.9 20 12066.7 28 12065.6 36 12064.7 44 12063.4 52 12062.1 60 12061.3 68 12060.9 76 12060.6 84 12057.9 92 12052.7 100 12052.1 TRACE mrjn05 6487 4923 358685.00 3154680.00 4 8 4 12068.6 12 12068 20 12066.9 28 12065.8 36 12064.7 44 12063.5 52 12062.2 OUTPUT ======= TRACE mrjn05 6487 4922 358666.00 3154690.00 4 8 4 12068.6 358666.00 3154690.00 12 12067.9 358666.00 3154690.00 20 12066.7 358666.00 3154690.00 28 12065.6 358666.00 3154690.00 36 12064.7 358666.00 3154690.00 44 12063.4 358666.00 3154690.00 52 12062.1 358666.00 3154690.00 60 12061.3 358666.00 3154690.00 68 12060.9 358666.00 3154690.00 76 12060.6 358666.00 3154690.00 84 12057.9 358666.00 3154690.00 92 12052.7 358666.00 3154690.00 TRACE mrjn05 6487 4923 358685.00 3154680.00 4 8 4 12068.6 358685.00 3154680.00 12 12068 358685.00 3154680.00 20 12066.9 358685.00 3154680.00 28 12065.8 358685.00 3154680.00 36 12064.7 358685.00 3154680.00 44 12063.5 358685.00 3154680.00 52 12062.2 358685.00 3154680.00 Any help on this will be higly appreciated. The file is really huge (about 800 MB) and I am just a beginer. Please help. Last edited by digipak; 05-05-2009 at 06:15 AM.. Reason: bad formatting |
|
||||
|
Guys thanks a lot, I tried the awk way and it works fine. I have made a note of the python script, when I am bit more comfortable with the UNIX, God willing, I will try that out. Franklin, thanks a lot for your help. Higly appreciated
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|