Easy one


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Easy one
# 1  
Old 04-14-2004
Easy one

Hi

This is going to sound so easy to some of you out there...

trying to copy and paste lines to an existing script - is there a command that i can use that overwrites the existing text there?

Cheers
# 2  
Old 04-14-2004
i personally dont know of a way to cut and replace... but if it exists, you will find it here...

http://www.thomer.com/vi/vi.html
# 3  
Old 04-14-2004
you can edit 2 files at once w/ vi.

you would cut the portions of file A into the buffer then switch to file B and paste.

check out the yy, P, :e options for vi.
# 4  
Old 04-14-2004
That doesnt give an overwrite function does it? He wanted to overwrite text with the paste.
# 5  
Old 04-14-2004
you could try the C operative for vi to overwrighting. couple the C operator w/ a selection of lines and it might work.


C = change rest of line.

either way i dont think this is an easy task unless you are very fluent w/ vi.
# 6  
Old 04-15-2004
I speak vi

You can overwrite the current line(s) with the output of a system command using double bang !!

e.g. To replace ten lines (starting from the current line) with the contents of another file use 10!!cat file
# 7  
Old 04-15-2004
Nearly

ok - its working but its quite messy using the !! command - it overwrites some and of the text and not others

- wot it is.... i have 2 sessions of unix open (different servers) and im basically trying to copy one script from the one box to the other ... it sounds easy but - as there is already a script there i need the script i am copying to overwrite the redundant script.....


is this any clearer ... any further suggestions please?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with this easy problem

hi people. i need assist in this quite easy problem. i have a text as: cell112-1/2/3/4/5/6 4 cell156-1/2/3/4 7 cell197-1/2/3 6 cell215-1/2/3/4/5/6 9 cell235-1/2/3 5 cell354-1/2/3/4/5 8 cell355-1 4 ... cell446-1/2/3/4/5/6 5 the script should check second coloumn in each line and ... (21 Replies)
Discussion started by: gc_sw
21 Replies

2. Shell Programming and Scripting

Help with an (easy) parser

Hello, i'm workig with a file with structural information about biological macromolecules (proteins etc). In a certain file, the info is structured like this @<TRIPOS>MOLECULE blah 1 blah 2 blah 3 @<TRIPOS>MOLECULE foo 1 foo 2 foo 3 @<TRIPOS>MOLECULE mmm 1 mmm 2 mmm 3 I would... (7 Replies)
Discussion started by: aristegui
7 Replies

3. UNIX for Dummies Questions & Answers

easy question

Hi everybody: Could anybody tell me if I have several files which each one it has this pattern name: name1.dat name2.dat name3.dat name4.dat name10.dat name11.dat name30.dat If I would like create one like: name_total.dat If I do: paste name*.dat > name_total.dat (15 Replies)
Discussion started by: tonet
15 Replies

4. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

5. Shell Programming and Scripting

easy script

a script, cheer that prints its parameter as shown in the example below. eg: $ cheer U N I X Give me a U! U! Give me a N! N! Give me a I! I! Give me a X! X! #!/bin/sh for letter do echo "Give me a $letter!";echo "$letter!" done this is the code i used for the above script (2 Replies)
Discussion started by: problems
2 Replies
Login or Register to Ask a Question