![]() |
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 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script for a 3 line paragraph | invinzin21 | Shell Programming and Scripting | 2 | 12-18-2007 01:11 AM |
| Appending a line in a file after a particular line | maxvirrozeito | Shell Programming and Scripting | 7 | 12-12-2007 01:58 PM |
| Appending line ending with '}" to new line | aismann | Shell Programming and Scripting | 4 | 08-13-2007 02:09 AM |
| Appending the line number and a seperator to each line of a file ? | pjcwhite | Shell Programming and Scripting | 4 | 03-21-2007 01:29 AM |
| Convert a paragraph to single line | rimss | Shell Programming and Scripting | 6 | 06-07-2006 03:17 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Have another question that has been eluding me all day.
I have data file I'm trying to reformat so that each line is appended with an ID code, but the ID code needs to update as it searches through the file. I.e. ----Begin Original Datafile----- Condition = XXX Header Line 1 Header Line 2 Station Data 1 5.43 2 6.43 3 7.8 4 450 5 650 Condition = YYY Header Line 1 Header Line 2 Station Data 1 654 2 987 3 875 4 874 5 678 Condition= ZZZ ZZZ . . . . ----------End Data File----------- and I would like to convert it to --------Begin Desired Datafile ------ Condition = XXX XXX Header Line 1 XXX Header Line 2 XXX XXX Station Data XXX 1 5.43 XXX 2 6.43 XXX 3 7.80 XXX 4 4500 XXX 5 6506 XXX XXX Condition = YYY YYY Header Line 1 YYY Header Line 2 YYY YYY Station Data YYY 1 654 YYY 2 987 YYY 3 875 YYY 4 874 YYY 5 678 YYY YYY Condition= ZZZ ZZZ . . . ------End Desired Datafile ------ With possibly several thousand unique Condition ID's and datasets. There are also some blank and header lines before each data set and appending the line identifier to those is just fine. All the blank and header lines are already being deleted at a later step. If it were just a few cases I could hard code it, but having the condition ID update as it goes is beyond me at the moment. Thanks in advance! So far you all have been extremely helpful and I'll definitely be back. Cheers Josh |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|