Page 1 of 1

Taking out a similar lines

Posted: Thu Jul 27, 2006 6:08 pm
by Siaruzb
Hello,

I am creating a following Index file:

Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#1-3
Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#2
Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#3
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#4-6
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#5
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#6

Is there any way to take out 2nd, 3rd, 5th and 6th lines? Thank you for your comments and suggestions.

Posted: Thu Jul 27, 2006 8:17 pm
by Bob Hansen
Search for: (^Q.*)\n.*\n.*\n
Replace with: \1\n

Regular Expression is checked. Using POSIX in Editor

You will have to repeatedly click on ReplaceNext vs. Replace All.
But you could make that into a macro and run it until all are done.

Posted: Thu Jul 27, 2006 8:25 pm
by Siaruzb
Thank you for suggestion.

I have put:
SEARCH\REPLACE\Find What: (^Q.*)\n.*\n.*\n
SEARCH\REPLACE\Replace with: \1\n

I have checked Regular Expression. But can not find an Editor....

Posted: Tue Sep 19, 2006 4:50 pm
by Siaruzb
I can run syntax above. But this syntax doesn't work. The syntax is recognised the similar lines but takes out all 3 lines.

Also (^Q.*)\n.*\n.*\n is not working.

Roght one is - ^Q.*\n.*\n.*\n

Can anybody help me with this?

Thanks.

Posted: Tue Sep 19, 2006 5:58 pm
by ben_josephs
What Bob meant was that you should use Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Tue Sep 19, 2006 6:14 pm
by Siaruzb
Thanks Ben. But again, it doesnt work properly. We have to start cheking the lines from bottom to top. The syntax taking out wrong lines.

Posted: Tue Sep 19, 2006 6:55 pm
by ben_josephs
I have no idea what you mean.

You are saying that the rule as Bob (quite reasonably) understood it is incorrect. This rule divides the input into groups of 3 lines, starting at the top, and deletes the 2nd and 3rd lines of each group.

Please explain more carefully exactly what you want converted into what and give examples that demonstrate this and show in what way Bob's suggestion doesn't work.

Posted: Tue Sep 19, 2006 7:03 pm
by Siaruzb
OK.

I am creating the INDEX file. I have following list of tables.

Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#1
Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#2
Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#3
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#4
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#5
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#6
Q11N: 1READ/LOOKED PRINTED EDTN OF PBLCTNS Table#11
Q11N: 1READ/LOOKED PRINTED EDTN OF PBLCTNS Table#12
Q11N: 1READ/LOOKED PRINTED EDTN OF PBLCTNS Table#13
Q12: 1NUMBER OF PRINT EDITIONS YOU RD - AA Table#14
Q12: 1NUMBER OF PRINT EDITIONS YOU RD - AA Table#15
Q12: 1NUMBER OF PRINT EDITIONS YOU RD - AA Table#16

Then I have to take out 2nd, 3th, 5th,6th, 12th, 13th, 15th and 16th lines. My final Index files should be like this:

Q1N: READ/LOOKED PRINTED EDTN OF PBLCTNS Table#1-3
Q2: NUMBER OF PRINT EDITIONS YOU RD - AA Table#4-6
Q11N: 1READ/LOOKED PRINTED EDTN OF PBLCTNS Table#11-13
Q12: 1NUMBER OF PRINT EDITIONS YOU RD - AA Table#14-16

So is there any way to do that? Thanks

Posted: Tue Sep 19, 2006 7:36 pm
by ben_josephs
That's exactly what Bob's suggestion does, except for changing the numbers after the '#', which you didn't mention before. Did you follow his instruction to repeatedly click on Replace Next rather than click once on Replace All. You have to start at the top of the file, of course.

Posted: Tue Sep 19, 2006 7:50 pm
by Siaruzb
OK. Got It. I had replaced All. Now its working. Great. Thanks.

Is there any way to put Table number too? Like after Table#1 put Table#1 - 3???

Thanks

Posted: Tue Sep 19, 2006 8:29 pm
by ben_josephs
Find what: (.*)#(.*)\n.*#.*\n.*#(.*)\n
Replace with: \1#\2-\3\n

[X] Regular expression

Posted: Tue Sep 19, 2006 8:35 pm
by Siaruzb
Thank you very much Ben.