Page 1 of 1

Find the TEXT1 and put the TEXT2 to the next line

Posted: Mon Jul 30, 2007 8:22 pm
by Siaruzb
Hi Guys,

I have the following syntaxex to run about 100 tables:

VARIABLE LABELS Q16 ''.
TABLES FORMAT=ZERO TFSPACE(0) SPACE NFRAME NBOX TTSPACE(1) PTSPACE(0)
/PFOOTNOTE=LEFT ".newpage"
/TABLE=T+A1+A2+A3+A4+A5+A6+A7+A8+A9 BY T2+Q16
/STAT=COUNT(T2(PAREN6)' ') CPCT(Q16(PCT3)' ':
PRINT TABLES DEVICE=OTHER/OUTPUT=TAB16.

VARIABLE LABELS Q17 ''.
TABLES FORMAT=ZERO TFSPACE(0) SPACE NFRAME NBOX TTSPACE(1) PTSPACE(0)
/PFOOTNOTE=LEFT ".newpage"
/TABLE=T+A1+A2+A3+A4+A5+A6+A7+A8+A9 BY T2+Q17
/STAT=COUNT(T2(PAREN6)' ') CPCT(Q17(PCT3)' ':
PRINT TABLES DEVICE=OTHER/OUTPUT=TAB17.

So I have to find this text:
/PFOOTNOTE=LEFT ".newpage"

Then have to put this text to the next line:
/SORT A1

Thank you.

Posted: Mon Jul 30, 2007 8:36 pm
by Bob Hansen
Explaining what to Find is good.

Not clear what you want to end up with, Please show sample of final lines when done with sample lines above.

Posted: Mon Jul 30, 2007 8:55 pm
by Siaruzb
Sorry, I have to add a new line with following text: /SORT A1

So final tables should be like this:

VARIABLE LABELS Q16 ''.
TABLES FORMAT=ZERO TFSPACE(0) SPACE NFRAME NBOX TTSPACE(1) PTSPACE(0)
/PFOOTNOTE=LEFT ".newpage"
/SORT A1
/TABLE=T+A1+A2+A3+A4+A5+A6+A7+A8+A9 BY T2+Q16
/STAT=COUNT(T2(PAREN6)' ') CPCT(Q16(PCT3)' ':
PRINT TABLES DEVICE=OTHER/OUTPUT=TAB16.

VARIABLE LABELS Q17 ''.
TABLES FORMAT=ZERO TFSPACE(0) SPACE NFRAME NBOX TTSPACE(1) PTSPACE(0)
/PFOOTNOTE=LEFT ".newpage"
/SORT A1
/TABLE=T+A1+A2+A3+A4+A5+A6+A7+A8+A9 BY T2+Q17
/STAT=COUNT(T2(PAREN6)' ') CPCT(Q17(PCT3)' ':
PRINT TABLES DEVICE=OTHER/OUTPUT=TAB17.

Posted: Mon Jul 30, 2007 11:46 pm
by Bob Hansen
Try this ..... untested!

Search for: /PFOOTNOTE=LEFT ".newpage"\n
Replace with: /PFOOTNOTE=LEFT ".newpage"\n/SORT A1\n

Checkmark in box for Regular Expressions
Checkmark in box for POSIX syntax (Configure/Preferences/Editor)

Posted: Tue Jul 31, 2007 6:27 pm
by Siaruzb
Great! It works perfectly.

Thank you very much Bob.