LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command line edit -- global find/replace on text file w/o going into vi (http://www.linuxquestions.org/questions/linux-newbie-8/command-line-edit-global-find-replace-on-text-file-w-o-going-into-vi-447819/)

car182 05-23-2006 03:00 PM

command line edit -- global find/replace on text file w/o going into vi
 
Hi all,

I'm a newbie to the Linux world and I am looking for an easy way to edit a file.

Basically, I want to perform a global/replace inside of a text file without going into vi.

I know how to go into vi and perform a global find/replace, but I want to do this in the shell (command line), not in vi -- that way I can do it nice a quick when I change configuration files.

Any suggestions? Thanks in advance.

Regards
car182:study:

reddazz 05-23-2006 03:06 PM

Take a look at the sed command.

chrism01 05-23-2006 10:51 PM

eg:
sed -i -e 's/DROP TABLE/DROP TABLE IF EXISTS/' ClientInfo_audit.sql
ie replace 1st string with 2nd string in file(s)

cs-cam 05-23-2006 11:31 PM

See my sig. 'Nuff said.

car182 05-25-2006 05:42 PM

Thanks
 
Thanks everyone for your responses


All times are GMT -5. The time now is 10:59 AM.