Title: UNIX help needed for sed multi-line pattern space
Alan,
 
Why not use awk?
 
cat filename | awk '{if  ( substr($0,length($0),1) == ";") {print " " $0 } else {printf($0) }}'
 
Hope this helps
 
Chris
 
 
-----Original Message-----
From: Martin, Alan [mailto:[EMAIL PROTECTED]]
Sent: 15 November 2001 17:55
To: Multiple recipients of list ORACLE-L
Subject: UNIX help needed for sed multi-line pattern space

If I have the following two-line sql statement in a file:

SELECT A,B,C FROM TABLE1
WHERE A=1;

and want to create a single line, I could use the following sed script:

/[^;]$/{
 N
 s/\n/ /
}

which would produce:

SELECT A,B,C FROM TABLE1 WHERE A=1;

What would my sed script look like if there were 2, 3, or even 4 continuation lines (unknown number of lines)?
Note that the file is too large for vi.
Any good UNIX sites where I could post UNIX questions?

Thanx,

Alan Martin
Principal Consultant
Defense Logistics Information Service
[EMAIL PROTECTED]


Reply via email to