deleting a 'tab' in certain situation

Find, replace, find in files, replace in files, regular expressions

deleting a 'tab' in certain situation

Postby dbibel » Wed Aug 30, 2006 12:56 pm

Hi:

I have a tab-delimited file that I need to work on.

In some cases, there is a number - tab - number sequence.

In other cases, there is a number - tab - alpha character or 'space' sequence.

In the first case, I'd like to delete the tab and concatenate the two numbers together.

In the second case, I'd like to just delete the tab.

I'm sure there is a way to do this, but I would v. much appreciate any help.

Thanks!

db
User avatar
dbibel
Newbie
 
Posts: 1
Joined: Tue Aug 29, 2006 11:00 pm

Re: deleting a 'tab' in certain situation

Postby Mofi » Wed Aug 30, 2006 1:09 pm

With an UltraEdit style regex (see Configuration - Search - Regular Expression Engine):

For "number - tab - number sequence":

Find: ^([0-9]^) - ^t - ^([0-9]^)
Replace: ^1^2

For "number - tab - alpha character or 'space' sequence":

Find: ^([0-9]^) - ^t - ^([~0-9^p]^)
Replace: ^1 - ^2

See help of UltraEdit about the Find command and Regular Expressions to understand this regexp strings or convert it to Unix/Perl style.

If this is not exactly what you need, your examples where not exact.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions