The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Pattern matching in file and then display 10 lines above every time namishtiwari Shell Programming and Scripting 30 04-13-2009 11:40 AM
pattern matching mercuryshipzz Shell Programming and Scripting 4 01-14-2008 11:01 PM
Reading lines in a file matching a pattern torenji Shell Programming and Scripting 4 10-25-2007 04:15 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 sed leemjesse Shell Programming and Scripting 3 03-23-2005 04:06 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-22-2008
trek trek is offline
Registered User
  
 

Join Date: Apr 2008
Location: Austria
Posts: 9
pattern matching over more lines

hi, i have a text file wich contains following informations:

1 Record 90 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:54:33)
1 YADM_20080101_A91645666_A91645666
4 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645666G001.jff
1 Record 91 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:55:36)
1 YADM_20080101_A91645690_A91645690
2 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645690G001.jff
1 Record 92 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:55:36)
1 YADM_20080101_A91645695_A91645695
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645695G001.jff
1 Record 93 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-16 16:13:13)
1 YADM_20080101_A91645701_A91645701
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645701G001.jff
3 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645701G002.jff
1 Record 94 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:55:36)
1 YADM_20080101_A91645705_A91645705
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645705G001.jff
1 Record 95 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:55:36)
1 YADM_20080101_A91645722_A91645722
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645722G001.jff
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645722G002.jff
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645722G003.jff
1 Record 96 in base GUJA_2008 (Created: 2008-01-14 19:00:38, Modified: 2008-01-15 18:55:36)
1 YADM_20080101_A91645756_A91645756
1 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645756G001.jff

Now i want to write a script which is searching between the lines Record...
If a *.jff line has a number, at the front of the line, which is greater than 1, then the line itself and the line after the "record.. line" for example, "YADM_20080101_A91645666_A91645666" should be printed.

The file should look like this after the pattern:

1 YADM_20080101_A91645666_A91645666
4 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645666G001.jff

1 YADM_20080101_A91645690_A91645690
2 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645690G001.jff

1 YADM_20080101_A91645701_A91645701
3 2008/01/15/ADM.ADM/20080101.ADM.ADM.A91645701G002.jff


is anyone able to help me?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0