![]() |
|
|
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 |
| I want to print next 3 lines after pattern matching. | naree | Shell Programming and Scripting | 12 | 05-21-2009 04:04 AM |
| Print the line within the search pattern | manosubsulo | Shell Programming and Scripting | 3 | 10-15-2008 08:11 AM |
| Print block of lines matching a pattern | vanand420 | Shell Programming and Scripting | 1 | 09-29-2008 06:09 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 03:41 PM |
| pattern matching and print with sed | nymus7 | Shell Programming and Scripting | 2 | 04-14-2005 10:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Are the two lines always consecutive?
Are there only two lines, and always two lines? It would probably be helpful to see a slightly larger sample file - perhaps maybe three pairs of data records? This makes it easier to write a command to extract appropriate data. |
|
|||||
|
Actually according to my script 3 lines will be outputed whenever a pattern is matched
Pattern line next immediate 2 lines -------------------------------------------------------------------------- Also the next 2 immediate line varies with each pattern found below few examples: 2008-10-14 05:47:05,551 [Thread-6] ERROR - CleanLPDataMessage: Missing Intervals: 1 2008-10-14 05:47:05,551 [Thread-6] INFO - LPBatch: [null, 1-GH32X, null, DC:Tue Oct 14 10:12:37 UTC 2008, null, null, Mon Oct 13 05:00:00 CDT 2008, Mon Oct 13 10:00:00 UTC 2008, Tue Oct 14 04:45:00 CDT 2008, Tue Oct 14 09:45:00 UTC 2008, CC, AMR, 94] 2008-10-14 05:47:05,575 [Thread-6] INFO - Number of Intervals Not Inserted: 1 / 95 ********************************************* 2008-10-14 05:50:54,072 [Thread-6] ERROR - CleanLPDataMessage: Missing Intervals: 1 2008-10-14 05:50:54,072 [Thread-6] INFO - LPBatch: [null, 1-150KP1, null, DC:Tue Oct 14 10:16:52 UTC 2008, null, null, Mon Oct 13 04:45:00 CDT 2008, Mon Oct 13 09:45:00 UTC 2008, Tue Oct 14 04:45:00 CDT 2008, Tue Oct 14 09:45:00 UTC 2008, CC, AMR, 95] 2008-10-14 05:50:54,101 [Thread-6] INFO - Number of Intervals Not Inserted: 1 / 96 **************************************************** 2008-10-14 05:55:41,604 [Thread-6] ERROR - CleanLPDataMessage: Missing Intervals: 1 2008-10-14 05:55:41,604 [Thread-6] INFO - LPBatch: [null, 1-VWEMR, null, DC:Tue Oct 14 10:22:06 UTC 2008, null, null, Mon Oct 13 04:30:00 CDT 2008, Mon Oct 13 09:30:00 UTC 2008, Tue Oct 14 05:00:00 CDT 2008, Tue Oct 14 10:00:00 UTC 2008, CC, AMR, 97] 2008-10-14 05:55:41,634 [Thread-6] INFO - Number of Intervals Not Inserted: 1 / 98 ********************************************* So i wanted the o/p in the below fashion 1-GH32X|CC|AMR|Number of Intervals Not Inserted: 1 / 95 1-150KP1|CC|AMR|Number of Intervals Not Inserted: 1 / 96 1-VWEMR|CC|AMR|Number of Intervals Not Inserted: 1 / 98 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|