Sorry this looks a bit long, but most of it is example data...
I'm new to using regular expression so please excuse my ignorance if this is easy to people who are more familiar with this.
I'm not a programmer, I just have files of text data that I wish to interogate and manipulate.
I am try ing to use a find to then go on and potentailly copy some data from a string of text where the string of text preceeding the data I wish to copy is variable. The only constants are that the first three charachters (alpha) will be constant and the string of text will have the same amount of + signs within it.
I want to be able to populate the 6 numberics which appear after the fourth + sign onto each line below it, up to the part where you reach END=n'
Example data below
Does this make sense? If so can any one help me?
Starting data
LMN=ABC:1+BBBB:COULD SAY AN+ZSED:COULD SAY ANYTHING INCLUDING SPACES+DDMMYYYY:HHMMSS+123456+AAAAAAA+ANYVALUES+A'
LINE OF CODE1
LINE OF CODE2
LINE OF CODE3
LINE OF CODE4
LINE OF CODE5
END=5'
LMN=ABC:1+C00016:DIFFERENT VALUES INC SPACES+Z00123:D COULD SAY ANYTHING INCLUDING SPACES+DDMMYYYY:HHMMSS+000001+AAAAAAA+ANYVALUES+A'
LINE OF CODE1
LINE OF CODE2
LINE OF CODE3
END=3'
LMN=FED:1+EDRE:COULD SAY ANYTHING INCLUDING SPACES+FERD:COULD SAY ANSPACES+DDMMYYYY:HHMMSS+9999+AAAAAAA+ANYVALUES+A'
LINE OF CODE1
END=1'
LMN=XYZ:5+BZER:ANYTHING+B456:OTHE TEXT+DDMMYYYY:HHMMSS+801207+JHYTHGH+JUHY01+T'
LINE OF CODE1
LINE OF CODE2
LINE OF CODE3
LINE OF CODE4
LINE OF CODE5
LINE OF CODE6
LINE OF CODE7
LINE OF CODE8
END=8'
I want this to use textpad to amend this to look like this;
LMN=ABC:1+BBBB:COULD SAY AN+ZSED:COULD SAY ANYTHING INCLUDING SPACES+DDMMYYYY:HHMMSS+123456+AAAAAAA+ANYVALUES+A'
123456 LINE OF CODE1
123456 LINE OF CODE2
123456 LINE OF CODE3
123456 LINE OF CODE4
123456 LINE OF CODE5
END=5'
LMN=ABC:1+C00016:DIFFERENT VALUES INC SPACES+Z00123:D COULD SAY ANYTHING INCLUDING SPACES+DDMMYYYY:HHMMSS+000001+AAAAAAA+ANYVALUES+A'
000001 LINE OF CODE1
000001 LINE OF CODE2
000001 LINE OF CODE3
END=3'
LMN=FED:1+EDRE:COULD SAY ANYTHING INCLUDING SPACES+FERD:COULD SAY ANSPACES+DDMMYYYY:HHMMSS+999999+AAAAAAA+ANYVALUES+A'
999999 LINE OF CODE1
END=1'
LMN=XYZ:5+BZER:ANYTHING+B456:OTHE TEXT+DDMMYYYY:HHMMSS+801207+JHYTHGH+JUHY01+T'
801207 LINE OF CODE1
801207 LINE OF CODE2
801207 LINE OF CODE3
801207 LINE OF CODE4
801207 LINE OF CODE5
801207 LINE OF CODE6
801207 LINE OF CODE7
801207 LINE OF CODE8
END=8'
Finding to copy a value from a line to another line
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm