LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 01: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, 01:34 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
:%y


Cheers,
Tink
 
Old 11-24-2007, 01: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, 02:20 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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, 03: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, 05:10 AM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,898

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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, 02:20 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 08:58 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 04:53 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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-26-2007, 12:11 AM   #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, 01:01 AM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 01: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, 02:18 AM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

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

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:35 AM
Command to select and move mutiple files from list in text file steve.paris Linux - Newbie 11 11-27-2005 01:44 PM
MySQL select command denied to user error lsimon4180 Linux - Software 2 03-03-2005 07:34 PM
Using escape string error in MySQL select command, any one can help me? myunicom Linux - General 2 02-16-2004 10:20 PM
select command slack66 Linux - General 3 07-12-2003 03:10 AM

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

All times are GMT -5. The time now is 12:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration