Select ALL in VI Editor


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Select ALL in VI Editor
# 15  
Old 08-11-2006
Quote:
Originally Posted by rakish
If i type



and if i open a new fine and do:

(not in command mode)

what i get is only 50 lines

and unix says



do u know whats going on here??

Thankyou.
Sorry, I can't help you here. I just ran tests yanking 100000 and 200000 lines into a buffer and I can switch files and paste every line. Perhaps your tmp space isn't adequate?
# 16  
Old 08-14-2006
I will want to add few more questions in the ongoing vi discussion, I have following quiries:

1) What about if I'm in the middle of a file and I want to yank from there to the end of file without knowing the number of lines, is it possible? suppose from line 12 to eof?

2) What is the command in vi to goto a specific line number, suppose I want to move cursor to the 1st line, 8th line or last line without knowing the total number of lines.

3) If there is any command in vi to count to number of lines?

4) How can I run shell commands without leaving the vi session.

5) How can I use vi non-interactively, can any one give a simple example here.

I personally believe that there should be a specific forum for UNIX editors, at least for vi, vim, & emacs. There are tons of tips and tricks related to these editors, which come only with practice and no one can find those in any tutorial. So it would be really great if our senior members share their experiences with novices like me. Lets hope Administrators of these forums think about that.

Cheers,
Patras
# 17  
Old 08-14-2006
Let's take them one by one.

1. You can do <n>,$y in the command mode where n is the number of line and $ represents end of file. e.g. :15,$y

2. you can just enter the line number in command mode. e.g. :20 with place the cursor at line 20.

3. You can always do a set nu in command mode and check it.

4. Do a !<command name> in escape mode.

5. Can you eloborate more on what you want.


I am also a novice ....but i think this might be helpful Smilie
regards
Apoorva Kumar
# 18  
Old 08-14-2006
Thanks for your reply.
Quote:
1. You can do <n>,$y in the command mode where n is the number of line and $ represents end of file. e.g. :15,$y
What about if I don't know the line number? Is there a way in vi to show the line number with each line? And what would be the command to copy lines from any line to begining of file ie 1st line?
Quote:
2. you can just enter the line number in command mode. e.g. :20 with place the cursor at line 20.
That works fine.
Quote:
3. You can always do a set nu in command mode and check it.
Can you pls give me example of this?
Quote:
4. Do a !<command name> in escape mode.
Yeah, that worked for me
Quote:
5. Can you eloborate more on what you want.
Suppose I want add a line "Test Line" after line number 11, without opening vi, is it possible?

Thanks in advance for any reply.

Cheers,
Patras
# 19  
Old 08-14-2006
Dear Patras,

Do a escape the print ": set nu".
I hope this will answer your 1 and 3 question. As far as your 5th point is concern you need to use sed with appened option, that needs some advance knowledge of sed.

regards
Apoorva Kumar
# 20  
Old 08-14-2006
Thanks a lot Mr. Kumar for your reply. set nu command is wonderful. Can you pls tell me if there is any way that when I login, my login files run automatically this command for vi? So I'll not have to worry about running this command every time I launch vi? You know any thing about that?
For point 5, it means non-interactive editing is not possible at all with vi?

Cheers,
Patras
# 21  
Old 08-14-2006
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Boot Loaders

Reboot and Select Proper Boot device or insert Boot media in select Boot device and press a key

Hello, I have kubuntu on my laptop and now I decided to switch to Windows 7. I made the bios settings properly (first choice is boot from cd\vd) but I see the error " reboot and select proper Boot device or insert Boot media in select Boot device and press a key " I have tried CD and... (0 Replies)
Discussion started by: rpf
0 Replies

2. UNIX for Advanced & Expert Users

more than 1 vi editor

Hi, What's the process to open 2 vi editor at a same time. Plz let me know. Thanx (5 Replies)
Discussion started by: reply2soumya
5 Replies

3. Shell Programming and Scripting

About vi editor

How can ` character be printed on vi editor ? empl_id=`echo $line | awk ' { print $1; } '` (2 Replies)
Discussion started by: senem
2 Replies

4. SCO

regarding vi editor

hello friends, i wud like to get some suggestion for a Q i faced in an interview.......... the Q is........... suppose a person is working on vi .the file is very large and he hasn't saved anything ........suddenly power goes off and system shuts down ...after power comes up the system is... (4 Replies)
Discussion started by: girish_shukla
4 Replies

5. Solaris

Epic Editor was not able to obtain a license for your use. Feature Epic Editor :Licen

Epic Editor was not able to obtain a license for your use. Feature Epic Editor :License server is down (1 Reply)
Discussion started by: durgaprasadr13
1 Replies

6. Shell Programming and Scripting

set EDITOR=vi -> default editor not setting for cron tab

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... (6 Replies)
Discussion started by: aarora_98
6 Replies

7. UNIX for Dummies Questions & Answers

Pasting text in VI editor from a different editor

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'. (10 Replies)
Discussion started by: harishmitty
10 Replies

8. UNIX and Linux Applications

VI Editor

I need to delete a line of statement with vi editior in linux, i am using rm but won't work. (3 Replies)
Discussion started by: doyindayo
3 Replies

9. UNIX for Advanced & Expert Users

How to select Test in Vi Editor

Guys, file1 is 10pages long in vi. How to select the complete contents of the life. Regards (2 Replies)
Discussion started by: Aejaz
2 Replies

10. UNIX for Dummies Questions & Answers

vi editor

is vi editor the same for all versions of Unix???? I mean are the commands the same for say Solaris or BSD (1 Reply)
Discussion started by: eloquent99
1 Replies
Login or Register to Ask a Question