How to remove leading blanks from a line

B

BI_Guy

I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 
G

garfield-n-odie [MVP]

The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.
 
W

Word_workerBEE

There are 2000 envelopes each having an name and address selecting the space
is very time consuming and tedious.
Not ever line has the space.

Example:
What I have:
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia

What I want
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia


I am looking for a find/replace string, regular expression or macro to solve
this problem.
I was able to do this twenty years ago with a simple line editor in UNIX, I
am sure
the bright people at microsoft have an easy to use elegant solution to this
problem.


garfield-n-odie said:
The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.


BI_Guy said:
I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 
S

Suzanne S. Barnhill

As indicated below, Ctrl+A, Ctrl+E, Ctrl+L will do it.

If you must use a Replace string, then perhaps you should investigate using
wildcards; see http://www.gmayor.com/replace_using_wildcards.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

Word_workerBEE said:
There are 2000 envelopes each having an name and address selecting the
space
is very time consuming and tedious.
Not ever line has the space.

Example:
What I have:
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia

What I want
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia


I am looking for a find/replace string, regular expression or macro to
solve
this problem.
I was able to do this twenty years ago with a simple line editor in UNIX,
I
am sure
the bright people at microsoft have an easy to use elegant solution to
this
problem.


garfield-n-odie said:
The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.


BI_Guy said:
I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 
W

Word_workerBEE

Thank you.

I did not understand that I need to do a select all before the Ctrl+A,
Ctrl+E, Ctrl+L.

Works as advertised thanks again.

Suzanne S. Barnhill said:
As indicated below, Ctrl+A, Ctrl+E, Ctrl+L will do it.

If you must use a Replace string, then perhaps you should investigate using
wildcards; see http://www.gmayor.com/replace_using_wildcards.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

Word_workerBEE said:
There are 2000 envelopes each having an name and address selecting the
space
is very time consuming and tedious.
Not ever line has the space.

Example:
What I have:
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia

What I want
Roger Marris
Mickey Mantle
Babe Ruth
Gil Hodges
Jolti Joe
Jery Garcia


I am looking for a find/replace string, regular expression or macro to
solve
this problem.
I was able to do this twenty years ago with a simple line editor in UNIX,
I
am sure
the bright people at microsoft have an easy to use elegant solution to
this
problem.


garfield-n-odie said:
The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.


BI_Guy wrote:
I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 
W

Word_workerBEE

Thank you.

I did not understand that I need to do a select all before the Ctrl+A,
Ctrl+E, Ctrl+L.

Works as advertised thanks again.


garfield-n-odie said:
The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.


BI_Guy said:
I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 
G

garfield-n-odie [MVP]

You do NOT need to do a select all before the Ctrl+A, because
Ctrl+A does a select all, as I explained in my original reply.


Word_workerBEE said:
Thank you.

I did not understand that I need to do a select all before the Ctrl+A,
Ctrl+E, Ctrl+L.

Works as advertised thanks again.


:

The easiest way to remove all leading and trailing spaces is to
press Ctrl+A to select all of the text, press Ctrl+E to center
the selection, and then press either Ctrl+L or Ctrl+J to left- or
full-justify the selection.


BI_Guy said:
I have been given
2000 envelopes in MS Word

Some lines have leading blanks.

How do I remove the first blank on a line.
In vi or ed I would say
1,$s/^ //

I have attempted the following find & replace

find: ^m[ ]
replace: ^m

where ^m is a page/section break
but I lose most of the envelopes

Thanks in advance for your assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top