LinuxAnswers - the LQ Linux tutorial section.
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 03-29-2005, 10:52 PM   #1
LQ Newbie
Registered: Mar 2005
Posts: 1

Rep: Reputation: 0
sed regular expression help needed

I am trying to make a sed script and have a question about doing a search and replace. I want to search for a word that starts with either upper or lower case (I know how to do that) and then replace it with another word that's first letter is of the same case as the original.

i.e. Smart becomes Dumb and smart becomes dumb.

Is there an easy way to do this with a one line command?

Thanks for the help!!!
Old 03-30-2005, 03:59 PM   #2
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 683

Rep: Reputation: 63
probably more simplistic than you wanted but...
sed 's/Smart/Dumb/g' filename| sed 's/smart/dumb/g'


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
Need help with regular expression aecaudel Programming 6 11-04-2005 06:28 AM
Need help with Regular Expression subaruwrx Linux - Newbie 6 09-04-2004 08:48 PM
Anyone know regular expression? ahhua Linux - Software 1 12-04-2003 09:13 AM
Regular Expression slizadel Programming 4 07-28-2003 06:16 AM
regular expression gumby Programming 3 07-15-2003 01:13 PM

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