The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Strip one line from 2 blank lines in a file tipsy Shell Programming and Scripting 6 06-23-2008 05:14 AM
how to read a file till it encounters a blank line adityam UNIX for Dummies Questions & Answers 1 11-25-2007 10:26 PM
how to read a file till it encounters a blank line adityam Shell Programming and Scripting 1 11-25-2007 10:15 PM
how to read a file till it encounters a blank line adityam Post Here to Contact Site Administrators and Moderators 0 11-25-2007 09:51 PM
why read line skips some lines... bluemoon1 Shell Programming and Scripting 8 10-07-2007 12:55 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Dec 2007
Posts: 10
Stumble this Post!
Read lines till a blank line is encountered

Hi,

I have reached at a specified offset from the start of file. My requirement is that I want to read only those lines, which have the string READ / ALTER / UPDATE. As soon as, none of these literals are found in the subsequent line, I want to stop reading. Is there any feature of grep which can help me do this?

I saw one post in which someone has suggested using sed command. I could not follow it.

Please suggest.

tail -n $remPart filename.txt | head -n 100 | ............

The part in red is what I want. This should ideally be the terminating condition..
TIA
Saurabh
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-19-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Stumble this Post!
Taking what you said literally....

Code:
while read N
do
        case "$N" in
        *READ* | *ALTER* | *UPDATE * )
              ;;
        * )
            exit
            ;;
        esac
done
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:03 AM.


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

Content Relevant URLs by vBSEO 3.2.0