Re: OT (sort of): VIM/ex/tr question

2000-11-26 Thread John P. Verel

Per Steve Kirkendall in comp.editors, this works:
:g/\s/j
One must admire the beauty and simplicity of this.
On 11/25/00, 03:13:48PM -0500, John P. Verel wrote:
 Greetings.
 
 I have a vim file which, in general, resembles this:
   Hello
 world
   Hello
 world
 
 I want to concatenate Hello and world.  fmt won't do because Hello ends with a
 newline character.
 
 I've tried the following (in vim 5.7), which does not work:
 
 :g/\s*/!!tr '\n' ' '
 
 The ex global command locates the lines with the white space, but the tr
 command won't translate the newline to a space.  The man page for tr shows \n
 as the special character for a newline.
 
 Any thoughts?
 
 TIA
 
 John



Re: OT (sort of): VIM/ex/tr question

2000-11-26 Thread davidturetsky

:g/$/j

worked for me

David

- Original Message -
From: "John P. Verel" [EMAIL PROTECTED]
To: "Mutt User List" [EMAIL PROTECTED]
Sent: Sunday, November 26, 2000 8:36 PM
Subject: Re: OT (sort of): VIM/ex/tr question


 Per Steve Kirkendall in comp.editors, this works:
 :g/\s/j
 One must admire the beauty and simplicity of this.
 On 11/25/00, 03:13:48PM -0500, John P. Verel wrote:
  Greetings.
 
  I have a vim file which, in general, resembles this:
  Hello
  world
  Hello
  world
 
  I want to concatenate Hello and world.  fmt won't do because Hello ends
with a
  newline character.
 
  I've tried the following (in vim 5.7), which does not work:
 
  :g/\s*/!!tr '\n' ' '
 
  The ex global command locates the lines with the white space, but the tr
  command won't translate the newline to a space.  The man page for tr
shows \n
  as the special character for a newline.






Re: OT (sort of): VIM/ex/tr question

2000-11-26 Thread davidturetsky

Actually you could search for any present character on the line. For
example:

:g/./j
:g/^/j
:g/$/j
:g/[a-z]/j

would all work

--
David
---
richSOB.com

- Original Message -
From: "davidturetsky" [EMAIL PROTECTED]
To: "Mutt User List" [EMAIL PROTECTED]
Sent: Sunday, November 26, 2000 10:17 PM
Subject: Re: OT (sort of): VIM/ex/tr question


 :g/$/j

 worked for me

 David

 - Original Message -
 From: "John P. Verel" [EMAIL PROTECTED]
 To: "Mutt User List" [EMAIL PROTECTED]
 Sent: Sunday, November 26, 2000 8:36 PM
 Subject: Re: OT (sort of): VIM/ex/tr question


  Per Steve Kirkendall in comp.editors, this works:
  :g/\s/j
  One must admire the beauty and simplicity of this.
  On 11/25/00, 03:13:48PM -0500, John P. Verel wrote:
   Greetings.
  
   I have a vim file which, in general, resembles this:
   Hello
   world
   Hello
   world
  
   I want to concatenate Hello and world.  fmt won't do because Hello
ends
 with a
   newline character.
  
   I've tried the following (in vim 5.7), which does not work:
  
   :g/\s*/!!tr '\n' ' '
  
   The ex global command locates the lines with the white space, but the
tr
   command won't translate the newline to a space.  The man page for tr
 shows \n
   as the special character for a newline.







Re: OT (sort of): VIM/ex/tr question

2000-11-26 Thread John P. Verel

On 11/26/00, 10:17:08PM -0500, davidturetsky wrote:
 :g/$/j
Yes, it does.  But I can't figure out why it should.  $ indicates last line in
stdin, right?  So, how does this work? 
 



Re: OT (sort of): VIM/ex/tr question

2000-11-26 Thread davidturetsky

The command says, 'search for every line where an end of line is present and
join it with the next line'

When used in pattern matching, $ is a reference to the end of the line
--
David
---
richSOB.com

- Original Message -
From: "John P. Verel" [EMAIL PROTECTED]
To: "davidturetsky" [EMAIL PROTECTED]
Cc: "Mutt User List" [EMAIL PROTECTED]
Sent: Sunday, November 26, 2000 11:03 PM
Subject: Re: OT (sort of): VIM/ex/tr question


 On 11/26/00, 10:17:08PM -0500, davidturetsky wrote:
  :g/$/j
 Yes, it does.  But I can't figure out why it should.  $ indicates last
line in
 stdin, right?  So, how does this work?