It is currently Tue, 17 May 2022 17:57:23 GMT

Author Message
 Best way to change the below via VI
I  have a text file with  with lots of the below.

tablespace "xxxx"
tablespace "xxxxyydld"
tablespace "dksld"

It other worlds I got tons of tablespaces  that have different names
of different lengths.

I need to change them all to say  tablespace "new"

Basically anything that matches the above I wish to change it to

Best way do do this, be my guest!

 Tue, 14 Oct 2003 01:18:16 GMT   
 Best way to change the below via VI

BTW, comp.editors is actually the best place for VI type
questions, but...
how about

:%s/tablespace ".*"/tablespace "new"/

John Yochum                     Agilent Technologies         Imaging Electronics Division

 Tue, 14 Oct 2003 01:32:26 GMT   
 Best way to change the below via VI

Without reading any more in to your example than you show:

:%s/\(tablespace\).*/\1 "new"/

 Tue, 14 Oct 2003 01:35:03 GMT   
 Best way to change the below via VI
On Thu, 26 Apr 2001 17:18:16 GMT, James Williams
sed -e"s/^tablespace.*/tablespace \"new\"/g" < file > file.out

How to do it in VI is left as an excercise for the reader :-)

The average woman would rather have beauty than brains
because the average man can see better than he can think.
GNU/Linux 2.4.3-ac12 SMP/ReiserFS 2x1743 bogomips load av: 0.13 0.03 0.01

 Tue, 14 Oct 2003 13:57:41 GMT   
 Best way to change the below via VI

Try this perl one-liner,

  perl -p -i -e 's/tablespace ".*"/tablespace "new"/' file

No temporary file is needed, like your sed example, as perl
will make the changes inplace.

David Thompson
Foster City, CA USA

 Thu, 16 Oct 2003 23:36:50 GMT   
   [ 5 post ] 

Similar Threads

1. changing password via WWW - best way?

2. Q: Good backup solution below $1000 ?

3. Best ways to increase the security of my linux box

4. Best ways of searching web pages - wais, swish etc

5. Q: The Best Ways to Have 4GB Linux Box

6. Best ways to optimise Linux

7. Best ways to handle function keys?

8. What are some good ways to do backups (across an Ethernet)

9. Good Ways to learn PERL????

10. i know there are better ways....

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software