pcregrep multiline SQL match

32 Views Asked by At

I'm trying to match following multiline SQL code with pcregrep:

   create table work.W4XLP0D as
      select distinct
         Name,
         ('ABCD') as xxx length = 4
   from &SYSLAST
      where Name='Alfred'
   ;

I wanna match distinct and ('ABCD') but it's possible that there are more than one Attributes in select statment... If tried the following:

[y1e1819@sasbidientw01 ~]$ pcregrep -M '(\n).*\(\".*\"\) as' *.sas
double_distinct.sas:         Name,
         ("ABCD") as xxx length = 4

But I'm not able how to say that there can be multiple line breaks

0

There are 0 best solutions below