Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-26-2011, 12:33 AM   #1
Registered: Jan 2011
Location: Dhaka
Posts: 80

Rep: Reputation: 1
Find and replace string

Hi Mates,

I need a help. I need to find this "TYPE=MyISAM;" and replace with "ENGINE=MyISAM;" in all .sql files in a directory. How can I do this with sed? Thanks for your help.
Old 07-26-2011, 01:11 AM   #2
Senior Member
Registered: Jan 2010
Posts: 1,622

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451

this should do it
sed -i.bak 's/TYPE=MyISAM;/ENGINE=MyISAM;/' *.sql
if all files are in the same directory. The -i.bak option will make a backup of the original file with *.bak suffix before making any changes.
Old 07-26-2011, 02:45 AM   #3
Registered: Jan 2011
Location: Dhaka
Posts: 80

Original Poster
Rep: Reputation: 1
Thanks a lot crts. That worked very well Thanks for you time.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and replace a string in a file using perl command from bash script koundinya749 Programming 5 02-15-2011 04:52 PM
Find & Replace string in multiple files Rudy Linux - General 14 04-15-2010 08:10 AM
Find and replace string Johng Programming 9 01-13-2010 04:50 AM
Linux command to find and replace string within text file chips11 Linux - Newbie 5 11-24-2008 02:25 PM
how to find and replace only the 2nd occurrence of similar string in a file hchoonbeng Linux - Newbie 1 10-08-2008 03:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:12 AM.

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