Friday, July 20, 2012

Re: Remove spaces and line breaks and make single line wihtout spaces

On 2012-07-20, vicky b wrote:

> On Fri, Jul 20, 2012 at 3:31 PM, Nicolas Dermine wrote:
>
> On 20 Jul 2012 11:30, "Dominique Pell " wrote:
> >
> > J rgen Kr mer wrote:
> >
> > > Hi,
> > >
> > > Am 20.07.2012 11:09 schrieb "vicky b":
> > >
> > >>
> > >> HI,
> > >>
> > >> I dint find any specific solution for my problem even after much of
> > >> googling
> > >>
> > >> i have following line
> > >>
> > >> <?xml version="1.0" encoding="UTF-8"?><SupportItem>
> > >> <ItemInfo>
> > >> <Name>First Name</Name>
> > >> <Type>INPUTEXT</Type>
> > >> <Value></Value>
> > >> <Mandatory>true</Mandatory>
> > >> <Description></Description>
> > >> <ImagePath></ImagePath>
> > >> <MaxLength>100</MaxLength>
> > >> </ItemInfo>
> > >> </SupportItem>
> > >>
> > >> i want to have it as below all line merged as single line and no
> spaces at
> > >> all
> > >>
> > >>
> > >> <?xmlversion="1.0"encoding="UTF-8"?><SupportItem><ItemInfo><Name>
> FirstName</Name><Type>INPUTEXT</Type><Value></Value><Mandatory>true</
> Mandatory<Description></Description><ImagePath></ImagePath><MaxLength>100</
> MaxLength></SupportItem>
> > >
> > > :%s/\n\s*//
> > >
> > > should do it.
> > >
> > > Regards,
> > > J rgen
> >
> > I think you meant this:
> >
> > :%s/\s*\n/
> >
> > ... since the spaces are before \n.
> >
> > -- Dominique
>
> No, at least in gmail the file seems to have whitespace at the beginning of
> lines (indentation).
>
> Nico

> Did that but still spaces in between .I have higlighted one of the spaces.
>
>
> <?xml version="1.0" encoding="UTF-8"?><SupportItem> <ItemInfo> <Name>First
> Name</Name> <Type>INPUTEXT</Type> <Value></Value> <Mandatory>true</
> Mandatory> <Description></Description> <ImagePath></ImagePath> <MaxLength>
> 100</MaxLength> </ItemInfo> </SupportItem

Some e-mail clients indent with non-breaking spaces, octets with the
value 0xA0, which are not recognized by Vim as whitespace. I can't
see any in your example, but I don't know what kind of
transformations may be taking place between your client and mine.

If that's the case, you'll have to account for them in whichever of
the suggested solutions works best for you, e.g.,

:%s/\n[\t\xa0 ]*//

Also please note the note at the bottom of each posting to this list
which says, "Do not top-post! Type your reply below the text you are
replying to."

Regards,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: