LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   editing expressions within a file (https://www.linuxquestions.org/questions/linux-newbie-8/editing-expressions-within-a-file-641066/)

DjRakso 05-09-2008 10:39 AM

editing expressions within a file
 
Hi,
I've got a simple question it may seem dumb.
I would like to change the within a bash_profile file a line to another line.
ex: export JAVA_HOME=/usr/java/jdk1.5.0_09/ to export JAVA_HOME=/usr/java/jre1.5.0_15/

I know I could simply use ex in linux and search for jdk1.5.0_09 and replace to jre1.5.0_09 but I would like to do the entire expression.
Just wondering is it possible if so can it be done with ex or do I need to use sed command?
Thx for reading my post.

pixellany 05-09-2008 10:59 AM

Just open any editor (I like nano) and edit the file.

If you WANT to do it with SED, then:

sed 's/oldtext/newtext/g' filename > newfilename

("g" changes all occurrences on a line)


All times are GMT -5. The time now is 05:28 AM.