1752661 Members
5725 Online
108788 Solutions
New Discussion юеВ

emacs

 
SOLVED
Go to solution

emacs

Good morning. I am trying to do something simple in emacs. I have never used it before. I am trying to do a global substitute in a file. I need to substitute the word lvmcong for lvmconf inthe entire file which is very large. Could someone please give me a command that does inside of emacs.
3 REPLIES 3
Radim Jarosek
Regular Advisor
Solution

Re: emacs

Hi,

why do you want to use emacs ? I think there are many ways how to do it the easiest way.

For instance :

1.
sed s/lvmcong/lvmconf/g name_file

2.
vi name_file

ex: s/lvmcong/lvmconf/g

Unfortunately, I've never used Emacs, but I suppose there is very similiar command as I described you above.

HTH

Radim

Re: emacs

Thankyou that worked. I was just trying ti figure emacs. I do have another question.
I am trying to use the find command to track down a word in a header file that is somewhwre in /usr/include. The string i am looking for is ptrdiff_t inside of one of the files. What find command would i use to list this file?
Bill Hassell
Honored Contributor

Re: emacs

The simplest is to use find as in:

$ find /usr/include -type f -exec grep -l ptrdiff_t {} \;
/usr/include/stddef.h

So the typedef is located in the stddef.h file. Using -l limits the output of grep to just the filename(s) that match.


Bill Hassell, sysadmin