Share your knowledge at the LQ Wiki.
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 05-23-2006, 03:39 AM   #1
Registered: Dec 2005
Posts: 48

Rep: Reputation: 15
how to find a pattern using shell script


I want to find and delete a pattern like
Connection <some string> = {

here "some string" may be any string and rest of the pattern is same.
So how can I accomplish this.Please help me to do the same.
Old 05-23-2006, 03:50 AM   #2
Registered: Mar 2006
Location: South Africa
Distribution: Arch Linux
Posts: 43

Rep: Reputation: 15
a string in a file i suppose?

well then there are programs like sed and grep

eg. cat infile | sed '1,6d'- delete lines 1,6
cat infile | sed 's/bob/greg/g' -replaces all instances of "bob" with "greg"

man sed for more...


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
Shell Script to Delete line if pattern exists topcat Programming 22 08-23-2011 04:58 AM
Shell script to find a particular string Prasun1 Linux - General 5 08-30-2005 09:23 AM
find shell script help liren Linux - Newbie 3 05-02-2005 03:05 PM
Procmail: match pattern then pass to shell script essdeeay Linux - Software 1 11-08-2004 02:19 PM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 06:25 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:28 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