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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
greping date in a file ali560045 Shell Programming and Scripting 3 02-20-2008 04:30 AM
need help in greping ali560045 Shell Programming and Scripting 4 02-12-2008 03:40 AM
greping with time stamp arunkumar_mca Shell Programming and Scripting 1 07-28-2006 01:20 AM
GREPing for Nulls Dr. DOT UNIX for Dummies Questions & Answers 4 09-17-2004 12:28 PM
Help with greping a field rooh UNIX for Dummies Questions & Answers 7 09-08-2003 09:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2006
csaha's Avatar
Registered User
 

Join Date: Feb 2005
Posts: 81
Greping certain lines

One of my outout is like this as shown below. How can I grep only the lines after the line "Affected files ...". No of lines after the line "Affected files ..." may vary.

$ cat file_A

Change 149133 by csaha@test_depo_csaha on 2006/02/08 01:40:57 *pending*

This is to test change #

Affected files ...

... //depot/users/csaha/chirantan/R&D1.doc#1 edit
... //depot/users/csaha/my-scripts/ecmsbuild.sh#2 edit
... //depot/users/csaha/my-scripts/eta noster gora.txt#1 add
... //depot/users/csaha/my-scripts/fs-dtls.sh#2 edit
... //depot/users/csaha/my-scripts/fs_usage_monitor.sh#2 edit
... //depot/users/csaha/my-scripts/server_info.sh#2 edit
Reply With Quote
Forum Sponsor
  #2  
Old 02-20-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
You could do this.

Code:
sed -n -e '/Affected files/,$p' | grep needle
It will gather all lines from "Affected files" till end of file.
Reply With Quote
  #3  
Old 02-21-2006
csaha's Avatar
Registered User
 

Join Date: Feb 2005
Posts: 81
Thanks for the code dude

Only this was enough

Code:
$ cat file_A | sed -n -e '/Affected files/,$p' 
Affected files ...
 
... //depot/users/csaha/chirantan/R&D1.doc#1 edit
... //depot/users/csaha/my-scripts/ecmsbuild.sh#2 edit
... //depot/users/csaha/my-scripts/eta noster gora.txt#1 add
... //depot/users/csaha/my-scripts/fs-dtls.sh#2 edit
... //depot/users/csaha/my-scripts/fs_usage_monitor.sh#2 edit
... //depot/users/csaha/my-scripts/server_info.sh#2 edit
Reply With Quote
  #4  
Old 02-21-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
Code:
cat file_A | sed -n -e '/Affected files/,$p'
That is a UUOC

Code:
sed -n -e '/Affected files/,$p' file_A
Reply With Quote
  #5  
Old 02-21-2006
csaha's Avatar
Registered User
 

Join Date: Feb 2005
Posts: 81
UUOC means ?
Reply With Quote
  #6  
Old 02-21-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,698
See this - UUOC
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0