LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   shell scripting question (https://www.linuxquestions.org/questions/linux-general-1/shell-scripting-question-523710/)

bhert 01-29-2007 05:45 AM

shell scripting question
 
Hello guys! I don't know if it's the right place for this kind of question.

In my file, I have names that begins with The.
What I want to do is move the word The to the end of the name with a comma.
for example,

The black hole
The mighty Ducks
change to

black hole,The
mighty ducks,The

What is the easiest way to get that done? Thanks

-bhert

raskin 01-29-2007 06:07 AM

sed -e 's/^The \(.*\)/\1, The/' -i file

bhert 01-29-2007 08:55 PM

Thanks raskin, works like a charm!:)
I didn't know about the -i option for sed, great thing to use!

-bhert


All times are GMT -5. The time now is 09:43 PM.