getting random string among a block and then putting it in another file...

Umibozu

Client
Регистрация
13.07.2011
Сообщения
18
Благодарностей
2
Баллы
0
Hi,
I started to feel I could do anything with macroses but this one got me stuck.
Let's say in file A I have:
/--/
a
b
c
/--/
a
b
c
/--/ and so on... just many blocks of 3 strings with delimiters.

In file B I have:
/--/
1
2
/--/
1
2
/--/
and so on... Other blocks of 2 strings that go on and on, and BETWEEN 1 and 2, I want to place the string either a, b or c (doesn't matter)

How would you go about this?
All I want is file B to look like:
/--/
1
a
2
/--/
1
c
2
/--/
1
a
2
/--/
1
b
2
/--/
1
c
2
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
You can do it such way.
Go thru all lines from file A, taking line one by one and if it is not /--/ keep it and insert in file B. (go thru file A making a loop).
Then if line from file A is not /--/ insert it (append a line to a file) with number N, where N=3 in the beginning and add 4 to the N each next step. So 3,7,11,15, etc.
 

Umibozu

Client
Регистрация
13.07.2011
Сообщения
18
Благодарностей
2
Баллы
0
Thanks but it looks my my main 2 questions are not answered as I didn't explain them well enough:
the file A is actually composed of:
a
b
c
/--/
d
e
f
/--/
g
h
i... And I want to parse only the a, b and c's to go to file B.

2nd question is:
my blocks in file B are made of random strings, sometimes 4 strings between delimiters, sometimes 5,6,7 or 8 strings and I want to place either a, b or c in between my random strings of file B.

I am still having the get.string not recognizing my regexp and am short of ideas.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)