Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 09-01-2002, 03:29 AM   #1
Registered: Apr 2002
Location: Earth globe
Distribution: Red Hat Linux
Posts: 35

Rep: Reputation: 15
multiline pattern search in a file

Hi guys
I have problem concerning bash programming
How can I search a multiline pattern in a file ( by "sed" or "grep" or ...)?
As far as I know these tools are line oriented, however "sed" gives the possibilty of multiline pattern,but I couldn't succeed in using it correctly.
Let me give you an example:
I want to search the following pattern in a file:

"Hello ! How are you?
I'm doing OK.
Wish you luck"

Note:These lines should follow each other without any extra lines between them.
And I want my search not to be case sensitive.

I would be so thankful if you show me the point
Old 09-01-2002, 12:22 PM   #2
LQ Newbie
Registered: Aug 2002
Posts: 8

Rep: Reputation: 0
Sed the carriage returns into some non-used character (| or such) and grep -i "Hello ! How are you?" |grep -i "I'm doing OK" |grep -i "Wish you luck"

perl would be easier.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
What is the Package Search pattern Syntax for dpkg --list? Akhran Debian 3 08-23-2005 05:23 AM
pattern search through find command. abhi Linux - Newbie 2 04-11-2005 10:31 AM
search for pattern in files and replace mizuki26 Linux - Newbie 3 01-04-2004 11:57 AM
Pattern search in a line jitz Linux - General 2 12-06-2003 04:50 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration