LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-18-2014, 02:31 AM   #1
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Rep: Reputation: 0
Multiple writes in Vim


Hi,
In vim ` :12,23 w >> ~/Dir/file " works fine for a one off,
does anyone know the command for multiple writes of say these
same lines to the same output file ?
many thanks,
lwv962.
 
Old 12-18-2014, 03:20 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
you could do it laterally, maybe ?

Code:
w > 1
cat 1 1 1 1 1 1 1 > /blah/blah/file
 
Old 12-18-2014, 06:53 AM   #3
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Original Poster
Rep: Reputation: 0
Thank you for reply bigearsbilly,but I cannot understand your idea,
 
Old 12-18-2014, 06:54 AM   #4
lwv962
Member
 
Registered: Feb 2011
Location: Wales
Distribution: MX Linux 18
Posts: 36

Original Poster
Rep: Reputation: 0
Thank you for reply bigearsbilly,but I cannot understand your idea,
could you clarify please.
 
Old 12-18-2014, 07:05 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
I mean, write it to a temporary file and then cat it onto what you want.
Not really in vim entirely, just a suggestion.

or yank it, open the file and paste multiple times.
 
Old 12-18-2014, 02:21 PM   #6
SoftSprocket
Member
 
Registered: Nov 2014
Posts: 399

Rep: Reputation: Disabled
Quote:
Originally Posted by lwv962 View Post
Hi,
In vim ` :12,23 w >> ~/Dir/file " works fine for a one off,
does anyone know the command for multiple writes of say these
same lines to the same output file ?
many thanks,
lwv962.
Vim does have a command line mode. I don't know if it supports your specific usage but it would look like:

Code:
vi -c ":12,23 w >> ~/Dir/file :q" the_source_file_name
Easy enough to put it in a loop.
 
  


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
Question about multiple writes from multiple processes rainman1985_2010 Programming 3 10-08-2010 02:39 PM
Multiple HDD writes required to render data irretrievable? catkin Linux - Security 20 11-14-2009 08:32 AM
Vim commands for multiple windows vijay_babu1981 Linux - Software 1 08-28-2009 01:01 AM
comment multiple lines in vim Furlinastis Slackware 9 12-11-2007 01:01 PM
multiple files in VIM james.farrow Linux - Newbie 3 07-09-2004 05:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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