Add a semi-colon (;) at the end of each line of text with RegEx

I am trying to add a semi-colon (;) at the end of each line of text in a file with many lines.   I want to use Regular Expressions to do it as I use UltraEdit editor (WindowsXP) which allows me to do a Search & Replace using Unix Regular Expressions.   If I use "$" it looks like it affects the carriage return (it puts a block instead of a ";" on every other line and a ";" at the beginning & end of every other line).

If I use ".$", it picks the last character instead of putting it at the end of the line (I would expect this).

How can I put a semi-colon at the end of each line?  Thank you for your help!
psmithphilAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tfewsterCommented:
Try
sed "s/\(.*\)/\1;/"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TintinCommented:
or simply

s/$/;/

0
psmithphilAuthor Commented:
Thank you for your efforts, but I can't get what you offered to work.

I would prefer to use utilities like "sed", etc.   The files I want to manipulate are in WindowsXP.  I've tried using the GNU Utilities for Windows, but they are unreliable (I can't get the "$" to work consistently).  And I don't want to use an emulator like Cgywin.

What I am therefore trying to use is the text editor UltraEdit. It allows me to use Unix Regular Expressions, but it has both search and replace boxes (like Microsoft Word), so I can't use things like "sed".  What I'm trying to do is find how I can get to the end of the line to add the semi-colon.  If I can't do it here, is there another way to do it?
0
psmithphilAuthor Commented:
Well, I got it to work.  UltraEdit is a little different.

In the Find box I put  (.+)$
In the Replace box I put  \1;

That put a semi-colon at the end of each line.  Sweet!

You two are the only ones who attempted to assist me and I appreciate it!   I am splitting the points between you.  Thank you!
0
TintinCommented:
Regexes implementations vary a bit, so what might work for one language/platform may not work for another.

I must admit, I'm not sure why you are reluctant to run cygwin, if you are happy to install GNU Utilities for Windows.

I find cygwin is such a valuable tool on all my Windows boxes.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.