LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-03-2013, 11:46 AM   #1
jbrulet
LQ Newbie
 
Registered: May 2013
Posts: 1

Rep: Reputation: Disabled
how to delete line 6 in vi


ow to delete line 6 in vi
 
Old 05-03-2013, 11:52 AM   #2
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,430

Rep: Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350
6Gdd
 
1 members found this post helpful.
Old 05-03-2013, 12:15 PM   #3
mddnix
Member
 
Registered: Mar 2013
Location: Bangalore, India
Distribution: Redhat, Arch, Ubuntu
Posts: 506

Rep: Reputation: 139Reputation: 139
If you are in 10th line, and you want to delete 6th line:
Code:
:6d
then to return back where you were...
Code:
''

Last edited by mddnix; 05-03-2013 at 12:50 PM.
 
2 members found this post helpful.
Old 05-03-2013, 12:33 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by allend View Post
6Gdd
To explain it little more,
Press 6 then Shift+G, then use dd to delete the 6th line.
 
Old 05-03-2013, 12:47 PM   #5
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,166
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Code:
vi +6 file
then dd works also.
 
Old 05-03-2013, 12:51 PM   #6
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
Just as an additional note - I have often found this 'ready-reference' guide useful - http://www.yolinux.com/TUTORIALS/Lin...vanced_vi.html
 
3 members found this post helpful.
Old 05-03-2013, 12:57 PM   #7
mddnix
Member
 
Registered: Mar 2013
Location: Bangalore, India
Distribution: Redhat, Arch, Ubuntu
Posts: 506

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by nonamedotc View Post
Just as an additional note - I have often found this 'ready-reference' guide useful - http://www.yolinux.com/TUTORIALS/Lin...vanced_vi.html
Good one!!! This goes to my bookmark...

Thanks
 
  


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
Need help with sed command: if a line contains >2 colons (:) delete it and line above kmkocot Linux - Newbie 1 12-27-2011 09:51 AM
script to read and delete a line from a file, if the line is 30 days old freakin.raja Linux - Newbie 7 09-17-2011 09:52 AM
need to delete a line if a field of that line matches using awf in bash scripting accesskarthi Linux - Newbie 8 06-29-2009 04:15 AM
Perl question: delete line from text file with duplicate match at beginning of line mrealty Programming 7 04-01-2009 07:46 PM
delete a line containing a pattern and the next line of a text file powah Programming 3 01-31-2007 06:34 PM


All times are GMT -5. The time now is 06:42 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