![]() |
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 |
| How to Append the specific data to the xml file | ravi_rn | Shell Programming and Scripting | 2 | 04-03-2009 02:01 AM |
| Extract specific pattern from a file | athreyavc | Shell Programming and Scripting | 4 | 11-12-2008 04:35 AM |
| serach and replace a specific pattern or value in a xml file | kiranreddy1215 | Shell Programming and Scripting | 1 | 08-13-2008 12:21 PM |
| How to read a specific value from a Log file? | cooolthud | Shell Programming and Scripting | 8 | 04-17-2008 11:30 AM |
| read specific text from a log file | ragha81 | Shell Programming and Scripting | 4 | 10-17-2006 01:17 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
read from a specific pattern from one file and append it to another
Hi! Everyone,
Say this file1 -------------- line 1 51610183 420001010 0010CTCTLEDPPOO 2151610183 line 2 2151610183 420001010 0030A2TH2 line 3 2151610183 420001010 0040A2TH3 line 4 2151610183 420001010 0050A2TH4 line 5 2151610183 420001010 0060A1TD1 line 6 51610183 420001013 0010CTCTLEDPPOO 2151610183 line 7 51610183 420001013 0020A1TH1 line 8 51610183 420001013 0030A2TH2 line 9 51610183 420001013 0040A2TH3 line 10 51610183 420001013 0050A2TH4 line 11 51610183 420001013 0060A1TD1 line 12 51610183 420001013 0070A2TD2 line 13 2195410283 420001354 0010CTCTLEDPPOO 2954610183 line 14 2195410283 420001354 0020A1TH1 line 15 2195410283 420001354 0030A2TH2 line 16 2195410283 420001354 0040A2TH3 line 17 2195410283 420001354 0050A2TH4 line 18 2195410283 420001354 0060A1TD1 line 19 2195410283 420001354 0070A2TD2 line nn nnnnnnnnnn nnnnnnnnn nnnnnnnnn I want to search in the file1 for the string '0010CTCTLEDPPOO'. When found at line number 1, I want to append all the lines strting from line1 to the line just before the next apparance of the string(in this example line6) to file2. Once appendng from line 1 to line 5 is done, I want to come back to file1 again search for the next appearance for sting '0010CTCTLEDPPOO' (in this example it is line 6) and then start appending the file2 again from line6 to line just before the next apparance of the string '0010CTCTLEDPPOO'.(in the example it is line 13) Likewise want to continue for the whole file1 irrespective of size. I am facing a rare challange while writing a unix script for it. Thanks in advance. Regards, Kinkar Ghosh |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|