Review your favorite Linux distribution.
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 05-09-2008, 11:39 AM   #1
LQ Newbie
Registered: Nov 2006
Posts: 12

Rep: Reputation: 0
editing expressions within a file

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.
Old 05-09-2008, 11:59 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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)


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
read-only file system error when editing a config file smallfrowne Linux - Newbie 5 02-19-2008 07:06 PM
editing a very large HTML file (or, extracting URLs from a file) Chriswaterguy Linux - Software 3 11-27-2007 07:07 PM
? on editing a file steve_f60 Linux - Software 4 09-20-2005 06:22 PM
file editing newdummy Linux - Newbie 5 03-18-2005 08:16 PM
File editing digger Linux - Newbie 3 01-28-2004 04:42 PM > Forums > Linux Forums > Linux - Newbie

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