The UNIX and Linux Forums  

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
Perl Pattern Matching nmattam Shell Programming and Scripting 2 09-28-2009 07:17 AM
Perl -Pattern Matching help..! coolbhai Shell Programming and Scripting 5 03-11-2009 01:15 PM
Perl Pattern Matching !!! Help maxmave Shell Programming and Scripting 0 06-03-2008 08:05 PM
perl pattern matching zedex Shell Programming and Scripting 2 09-30-2007 09:29 AM
perl pattern matching vs. grep junkmail426 Shell Programming and Scripting 0 09-28-2005 11:40 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 09-29-2009
nmattam nmattam is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 13
Perl pattern matching!!

Hi experts,

I have many occurances of the following headers in a file. I need to grep for the word changed/inserted in the header, calculate the difference between the two numbers and list the count incrementally.
Headers in a file look like this:
----------[changed to 229-232]---------
-----------[inserted 294-296]----------
------------[changed to 861]-----------

I should grep for the word changed, also grep the numbers listed 229 and 232 and find their difference. The difference in the number of lines is the output. Similarly grep for inserted and the difference in the numbers. If the header contains just one number increment by one.
Output should be like:
Number of lines changed :4 (here 3 from first header and one from last header matching the word changed)
Number of lines inserted :2

Please help me, i am held up with this for long.
 

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 05:52 AM.


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