LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2007, 12:24 AM   #1
nagabioinfo
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Rep: Reputation: 0
Cool select all command in vi


Hello all,

Can anybody tell me the select all and copy command in vi (having thousands of line to copy, so mouse willnt help here). I searched in google and couldnt able to find it.

sincerely
naga
 
Old 11-24-2007, 12:34 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
:%y


Cheers,
Tink
 
Old 11-24-2007, 12:48 AM   #3
nagabioinfo
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
hi,

:%y, yanks all the lines in a vi file, but when i use 'p' to paste it in another file, only 50 lines are pasting.!!!

how do i paste all the yanked lines ??

naga
 
Old 11-24-2007, 01:20 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I wonder if this is a "vi" memory limitation. I suppose a work around could be to save the range you want to past to a file and then insert that file in the other buffer.
 
Old 11-24-2007, 02:03 AM   #5
nagabioinfo
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
but if its a memory limitation, why its copying/yanking all the lines (around 9300).. ? is there any special paste command to do this..!!
 
Old 11-24-2007, 04:10 AM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
There may be a default yank buffer size, but you may be able to override that default 'on the fly' by specifying the number of lines to yank: 9300yy.
 
Old 11-24-2007, 01:20 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by nagabioinfo View Post
but if its a memory limitation, why its copying/yanking all the lines (around 9300).. ? is there any special paste command to do this..!!
Not sure ... I'm using vim here, not vi, and it works just
fine. Yanked & pasted large amounts of data just then.
Code:
$ ls -l log*
-rw-r--r-- 1 tink   tink   4402338 2007-11-25 08:13 log
-rw-r--r-- 1 tink   tink         0 2007-11-25 08:17 log2
$ vim log log2
:%y
412091 lines yanked
:n
p
412091 more lines


Cheers,
Tink
 
Old 11-24-2007, 07:58 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If I want a whole file or large chunks thereof, i just take a copy of the file and chop the top/bottom as needed.
I use the ctrl-g combo to find the line nums/amts to remove from the copy, then save (:w) and import using :r file.tmp.
 
Old 11-25-2007, 03:53 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can write a portion of a file by giving the line number range as well:
For example:
:100,1100w filename
You don't need to delete any lines.
 
Old 11-25-2007, 11:11 PM   #10
nagabioinfo
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
but the file i need to copy is in remote machine, if i need to do a scp from my system i need the password of the remote system, which i dont have (the guy who knows the password is on vacation, but i have logged into machine before he left). the only possible way i can do this is to copy all those lines from the remote machine file and paste it in a new file in my machine.

naga
 
Old 11-26-2007, 12:01 AM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Errrh .... if you have a remote session on the other box open,
why don't you just scp FROM there to your own box? Surely you
know your own password on your local machine?



Cheers,
Tink
 
Old 11-26-2007, 12:12 AM   #12
nagabioinfo
LQ Newbie
 
Registered: Aug 2007
Posts: 13

Original Poster
Rep: Reputation: 0
ya..!! but its an one way network, i can do scp only from my machine, and scp from the remote cluster is blocked.

naga
 
Old 11-26-2007, 01:18 AM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Talk you local sysadmin
 
Old 11-26-2007, 08:52 AM   #14
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you are logged in remotely, you can scp from the remote shell to your local machine.
Then you need to enter password on your local machine which you know.

scp file you@localmachine:file
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy select files with command line Storyman Linux - Newbie 5 01-23-2007 03:35 AM
Command to select and move mutiple files from list in text file steve.paris Linux - Newbie 11 11-27-2005 12:44 PM
MySQL select command denied to user error lsimon4180 Linux - Software 2 03-03-2005 06:34 PM
Using escape string error in MySQL select command, any one can help me? myunicom Linux - General 2 02-16-2004 09:20 PM
select command slack66 Linux - General 3 07-12-2003 02:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration