l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 16:49

The following is an archive of a post made to our 'vox mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox] Help with Regular Expression?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox] Help with Regular Expression?

This is going to vary a lot depending on the tool used and what you define to be a string.

Here's an example that's really ugly but works with under Red Hat 7.1.  But I think
learning Perl is going to be your best bet for things like this.

cat myfile | sed -e 's/\(^\| \)\([^A ]\)/\1A\2/g' | sed -e 's/\([^A ]\)\( \|$\)/\1A\2/g'

-- Rod

> How in the world would you go about putting a character at the beginning of  a string
> or the end if the character isn't there?
> For example,
>         Bob     becomes         ABobA
>         ABob    becomes         ABobA
>         BobA    becomes         ABobA
>         ABobA   becomes         ABobA
> Sliante,
> Richard S. Crawford
> http://www.mossroot.com
> mailto:rscrawford@mossroot.com
> AIM: Buffalo2K
> "It is only with the heart that we see rightly; what is essential is  invisible to
> the eye."  --Antoine de Saint Exupéry
> "Push the button, Max!"

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.