Go Back   Technology Questions > Software Questions > Operating System Questions > Linux

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-20-2008, 05:20 AM
Artnut
Tablet PC Guest
 
Posts: n/a
Copying to a new file

Hi all,

The other day I was browsing through the Vimtutor which runs as a command.
It opens as a tutorial. I would like to know how can I copy, paste the
entire contents to a new file. If I yank the contents, they can only be
copied to the same file. Maybe I am doing something wrong but does VIM
really have a facility/command to copy to another file?
I tried the usual cp command but that copies the command and its code for
the Vimtutor.

Also, how do I read the lessons numbered as |usr_1.txt| ?


Thank you in advance.

Arty


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-20-2008, 05:20 AM
Xploder HD Movie Player for PS3. Manage, convert and transfer media files between the PC and PS3.
  #2 (permalink)  
Old 06-20-2008, 06:00 AM
sk8r-365
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard Artnut typed:

<snip>
> Also, how do I read the lessons numbered as |usr_1.txt| ?


:help usr_01.txt

--
sk8r-365
But the children of the kingdom shall be cast out into outer
darkness: there shall be weeping and gnashing of teeth.
-- Matthew 8:12
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 06-20-2008, 06:40 AM
sk8r-365
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard Artnut typed:
> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a command.
> It opens as a tutorial. I would like to know how can I copy, paste the
> entire contents to a new file. If I yank the contents, they can only be
> copied to the same file.

<snip>

I don't bother with that. I use gnome-terminal's menu, but maybe this
will help if you open a second buffer:
http://www.cs.fsu.edu/general/vimanual.html#copypaste

--
sk8r-365
Philip, and Bartholomew; Thomas, and Matthew the publican; James
the son of Alphaeus, and Lebbaeus, whose surname was Thaddaeus;
-- Matthew 10:3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 06-20-2008, 11:40 AM
Beej Jorgensen
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

Artnut <art******.com> wrote:
>The other day I was browsing through the Vimtutor which runs as a command.
>It opens as a tutorial. I would like to know how can I copy, paste the
>entire contents to a new file.


If you want the entire contents, you can just write the whole buffer to
a new file:

:w foo.txt

-Beej

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 06-21-2008, 01:10 PM
coffee
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

On Fri, 20 Jun 2008 18:43:11 +0530, Artnut wrote:

> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a
> command. It opens as a tutorial. I would like to know how can I copy,
> paste the entire contents to a new file. If I yank the contents, they
> can only be copied to the same file. Maybe I am doing something wrong
> but does VIM really have a facility/command to copy to another file? I
> tried the usual cp command but that copies the command and its code for
> the Vimtutor.
>
> Also, how do I read the lessons numbered as |usr_1.txt| ?
>
>
> Thank you in advance.
>
> Arty


Arty;


cp origional-file.txt newfile.txt

To assemble avi slices from newsgroups:

cat firstfile.avi.0* > movie.avi

Or, You can copy the contents of a file also by:

cat originalfile.txt > newfile.txt

helps?


coffee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #6 (permalink)  
Old 06-22-2008, 12:10 AM
Artnut
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file


"coffee" <coffee@the-bunker.com> wrote in message
news:9oWdnUbt15wM98DVnZ2dnUVZ_szinZ2d@giganews.com ...
> On Fri, 20 Jun 2008 18:43:11 +0530, Artnut wrote:
>
>> Hi all,
>>
>> The other day I was browsing through the Vimtutor which runs as a
>> command. It opens as a tutorial. I would like to know how can I copy,
>> paste the entire contents to a new file. If I yank the contents, they
>> can only be copied to the same file. Maybe I am doing something wrong
>> but does VIM really have a facility/command to copy to another file? I
>> tried the usual cp command but that copies the command and its code for
>> the Vimtutor.
>>
>> Also, how do I read the lessons numbered as |usr_1.txt| ?
>>
>>
>> Thank you in advance.
>>
>> Arty

>
> Arty;
>
>
> cp origional-file.txt newfile.txt
>
> To assemble avi slices from newsgroups:
>
> cat firstfile.avi.0* > movie.avi
>
> Or, You can copy the contents of a file also by:
>
> cat originalfile.txt > newfile.txt
>
> helps?
>
>
> coffee



Hey Coffee and others, thanks indeed for the replies. Ideally cat abc.txt >
xyz.txt would help but vimtutor is a command which opens as tutorial in Vi
or Vim. If I yank those 970 lines and I open a blank new file, I cannot p
(paste) because it is not programmed that way. It means I can only paste the
yanked 970 lines in the same tutorial giving me additional 970 lines! I
don't understand why this limitation for a command related file. I can copy
from a normal vi file and paste into another new vi file but cannot do so
with a command output file.


Thank you,

Arty


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 06-22-2008, 12:30 AM
J.O. Aho
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

Artnut wrote:

> Hey Coffee and others, thanks indeed for the replies. Ideally cat abc.txt >
> xyz.txt would help but vimtutor is a command which opens as tutorial in Vi
> or Vim. If I yank those 970 lines and I open a blank new file, I cannot p
> (paste) because it is not programmed that way. It means I can only paste the
> yanked 970 lines in the same tutorial giving me additional 970 lines! I
> don't understand why this limitation for a command related file. I can copy
> from a normal vi file and paste into another new vi file but cannot do so
> with a command output file.


Mark the text you want to copy in vi with your mouse (hold your left
mouse button pressed and move the pointer to the end of the text
visible), switch focus to the program which you want to save the text
with and press your middle button. Repeat this until you copied all the
rows and then save the newly created file.


--

//Aho
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 06-22-2008, 06:00 AM
sk8r-365
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

Feverishly pounding upon a keyboard coffee typed:


To build upon coffee's info:

> cp origional-file.txt newfile.txt
>
> To assemble avi slices from newsgroups:
>
> cat firstfile.avi.0* > movie.avi


or

cat firstfile.avi.??? > movie.avi


> Or, You can copy the contents of a file also by:
>
> cat originalfile.txt > newfile.txt


The single '>' overwrites anything in newfile.txt. Which is OK if it's
empty, but using '>>' would be needed to add (append) text.


--
sk8r-365
And the same John had his raiment of camel's hair, and a leathern
girdle about his loins; and his meat was locusts and wild honey.
-- Matthew 3:4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 06-23-2008, 03:00 AM
birre
Tablet PC Guest
 
Posts: n/a
Re: Copying to a new file

On 2008-06-20 15:13, Artnut wrote:
> Hi all,
>
> The other day I was browsing through the Vimtutor which runs as a command.
> It opens as a tutorial. I would like to know how can I copy, paste the
> entire contents to a new file. If I yank the contents, they can only be
> copied to the same file. Maybe I am doing something wrong but does VIM
> really have a facility/command to copy to another file?
> I tried the usual cp command but that copies the command and its code for
> the Vimtutor.
>
> Also, how do I read the lessons numbered as |usr_1.txt| ?
>
>
> Thank you in advance.
>
> Arty
>
>


You must remember that you can filter any range of your text to any unix
command, so you can also use the command cat to save a contents to a file.


Go to the last line you will cut to a file, mark it as a (ma)

Go to the first line and do !'a (you will get a ! on the bottom line
now type:
cat >filename<cr>

If you will have the contents back use undo (u)

/bb
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File copying sometimes does not work Fishyweb Windows Vista 2 05-28-2008 04:50 AM
copying a file The Red Baron Microsoft Office 1 04-21-2008 02:00 AM
WMDC Changes File Date When copying file to Laptop Bob Windows Vista 4 03-28-2007 02:15 PM
File Copying from OS9.1 to OSX Bebop3351 Apple Macintosh Hardware 5 02-06-2007 03:43 PM
file copying problem jcrystal Windows XP 3 01-21-2007 03:00 PM


All times are GMT -8. The time now is 01:10 PM.


2003 - 2008 All Rights Reserved. Technology Questions

SEO by vBSEO 3.1.0