Vi editor ?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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
# 2  
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/

;
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Epic Editor was not able to obtain a license for your use. Feature Epic Editor :Licen
durgaprasadr13
Epic Editor was not able to obtain a license for your use. Feature Epic Editor :License server is down... Solaris
1
Solaris
set EDITOR=vi -> default editor not setting for cron tab
aarora_98
Hi All, I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by set EDITOR=vi it does not open a vi editor , rather it do as below..... ///////////////////////////////////////////////////// $ set...... Shell Programming and Scripting
6
Shell Programming and Scripting
Pasting text in VI editor from a different editor
harishmitty
Hi, I knw its a silly question, but am a newbie to 'vi' editor. I'm forced to use this, hence kindly help me with this question. How can i paste a chunk 'copied from' a different editor(gedit) in 'vi editor'? As i see, p & P options does work only within 'vi'.... UNIX for Dummies Questions & Answers
10
UNIX for Dummies Questions & Answers
VI Editor
doyindayo
I need to delete a line of statement with vi editior in linux, i am using rm but won't work.... UNIX and Linux Applications
3
UNIX and Linux Applications
vi editor
diptiman
suppose i have a lines as follows -rw-r----- 1 ora92 orainst 104846848 Jan 15 2005 0001_0000003971.arc -rw-r----- 1 ora92 orainst 104851456 Jan 15 2005 0001_0000003972.arc -rw-r----- 1 ora92 orainst 104852992 Jan 15 2005 0001_0000003973.arc -rw-r----- 1 ora92 orainst...... Solaris
15
Solaris