LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-01-2002, 03:29 AM   #1
mimi
Member
 
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
sprack
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.
 
  


Reply


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


All times are GMT -5. The time now is 05:40 PM.

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