We help IT Professionals succeed at work.

Regular Expression Help: Replace in UltraEdit

neal_harmon
neal_harmon used Ask the Experts™
on
hopefully this will come out right....

i have a text file that needs to have instances of GA replaced with GC...I was passed the following 2 commands from a unix guy (and i'm a windows guy) - so here is the disconnect!

1) how would I use these inside UltraEdit

2) what exactly (in english) is the function they are performing...i don't know what all the switches are commanding it to do.


1,$s/^\(C[0-9][0-9][A-Z][A-Z]      \)\([A-Z][A-Z]\)/\1GC  


1,$s/^\([C-Z][0-9][0-9]\)\([A-Z][A-Z]\)/\1GC  


Thanks!!!!!!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Expert of the Quarter 2010
Expert of the Year 2010

Commented:
Won't a simple search and replace WITHOUT regular expressions work for GA (match case) to GC?  Optionally tick "whole words" if requierd.
1) In UltraEdit, if it supports RegEx search/replace, use the following:

2) In vim, you have to press <ESCAPE> then <COLON> and then type the following commands:


1,$s/^\(C[0-9][0-9][A-Z][A-Z]       \)\([A-Z][A-Z]\)/\1GC  

This is telling vi to do a substitution (s) starting from 1st row to the end ($),
Search for: ^\(C[0-9][0-9][A-Z][A-Z]       \)\([A-Z][A-Z]\)
Replace with: \1GC



1,$s/^\([C-Z][0-9][0-9]\)\([A-Z][A-Z]\)/\1GC    

This is telling vi to do a substitution (s) starting from 1st  row to the end ($),
Search for: ^\([C-Z][0-9][0-9]\)\([A-Z][A-Z]\)
 Replace with: \1GC