The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
set EDITOR=vi -> default editor not setting for cron tab aarora_98 Shell Programming and Scripting 6 09-12-2008 11:01 PM
Which editor to use? Nafanja UNIX for Dummies Questions & Answers 5 11-29-2007 09:58 AM
Vi editor jazz High Level Programming 1 11-17-2005 05:37 AM
vi editor eloquent99 UNIX for Dummies Questions & Answers 1 01-14-2003 02:49 AM
Using the vi editor pbsys UNIX for Dummies Questions & Answers 2 11-05-2001 12:27 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-27-2005
Registered User
 

Join Date: Jun 2005
Posts: 9
Vi editor ?

Hello everybody,

My question is: how to add /tmp/work at the end of line in vi editor.

my file looks like:

cp file1
cp file2
cp file3
****

I need to add " /tmp/work" at the end of each line.
I tried this
:%s/$/" /tmp/work"

and this
:%s/$/\ /tmp/work\/

but it does not work.

Please help.

Thank you
Reply With Quote
Forum Sponsor
  #2  
Old 06-27-2005
Registered User
 

Join Date: Jun 2005
Posts: 18
Quote:
Originally Posted by billy5
Hello everybody,

My question is: how to add /tmp/work at the end of line in vi editor.

my file looks like:

cp file1
cp file2
cp file3
****

I need to add " /tmp/work" at the end of each line.
I tried this
:%s/$/" /tmp/work"

and this
:%s/$/\ /tmp/work\/
There are a couple of ways to fix this. First, remember that the / between tmp and work is seen as a separator. So you can use
:%s/$/ \/tmp\/work\//

or you could change the separator like this:

"%s:$: /tmp/work/:

Both of these options will change the file to

cp file1 /tmp/work/
cp file2 /tmp/work/
cp file3 /tmp/work/

;
Reply With Quote
  #3  
Old 06-27-2005
Registered User
 

Join Date: Jun 2005
Posts: 9
Thank you very much .
All the best.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0