Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace two characters in the middle of a string 1

Status
Not open for further replies.

reclspeak

IS-IT--Management
Dec 6, 2002
57
GB
Hi!

I am scripting a solution that requires two characters to be replaced in a string that appears in a file (with other unrelated strings) and I'm struggling to figure-out a routine that will satisfy the requirement.

The string is always consistent, and is in the form;

INV_20070430131255_H062849B.DAT

It appears in a file as the 8th record on the first line of numerous lines. Each record is delimited with a "|" character.

The string after "INV" is the date, month, day, hour and minute and then millisecond (in this case "55"). After this string, there is another underscore, followed by a string that always begins with "H" and ends with ".DAT".

What I am trying to do is replace just the two characters for the "55" with "zz" These are always the 13th & 14th characters in the long numeric string after "INV_"

I'm struggling to find a placeholder routine that will zero-in on just those two digits.

Any assistace with this would be gratefully received.


recl
 
Thanks Feherke,

I'll give them a try tomorrow morning (in the UK) and report how I got on.

recl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top