Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return.

ie
i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME.

Any ideas are appreciated!

\(\<\).*\(\<\).*\(N\).*\(A\).*\(M\).*\(E\).*\(\>\).*\(\>\)

%%EndFeature
} stopped cleartomark
%%EndSetup
NTPSOct95 begin
%%Page: 1 1
NTPSOct95 /PageSV save put
1 792 translate 72 300 div dup neg scale
0 0 transform .25 add round .25 sub exch .25 add round .25 sub exch itransform translate
%%IncludeFont: Times-Roman
[50 0 0 -50 0 0]/Times-Roman MF
(T)371 345 MS (e)402 345 MS (s)424 345 MS (t)443 345 MS ( )458 345 MS (p)471 345 MS (s)496 345 MS ( )515 345 MS (f)528 345 MS (i)543 345 MS (l)555 345 MS (e)567 345 MS ( )589 345 MS (w)602 345 MS (i)638 345 MS (t)650 345 MS
(h)665 345 MS ( )689 345 MS (a)702 345 MS ( )724 345 MS ( )737 345 MS (s)750 345 MS (p)769 345 MS (e)794 345 MS (c)816 345 MS (i)838 345 MS (a)850 345 MS (l)872 345 MS ( )884 345 MS (f)897 345 MS (i)912 345 MS (e)924 345 MS
(l)946 345 MS (d)958 345 MS ( )983 345 MS (t)996 345 MS (o)1011 345 MS ( )1037 345 MS (p)1050 345 MS (a)1075 345 MS (r)1097 345 MS (s)1114 345 MS (e)1133 345 MS ( )1155 345 MS (a)1168 345 MS ( )1190 345 MS (<)1203 345 MS (<)1231 345 MS
(N)1259 345 MS (A)1295 345 MS (M)1330 345 MS (E)1374 345 MS (>)1405 345 MS (>)1433 345 MS ( )1461 345 MS (t)1474 345 MS (o)1489 345 MS (.)1515 345 MS
( )1528 345 MS
PageSV restore
showpage

(<ps file output> | <the_sed_command_below...>)

sed '
:loop
$!{
/<<$/{N; s|<<\nNAME>>| **something** |;}
/\\$/t loop
}'

This can be improved upon, but this should get you started.

From the look of your data - you'd need a number of commands....becasue the <<NAME>> could be line broken at any point across the field....is this so?

<
<NAME>>

or

<<
NAME>>

or

<<N
AME>>

etc.....

According to the code above, this should be

<<
NAME>>

BUT... as a catch all :slight_smile: <w/ corrections ... my bad!>

sed '
$!{ /<<*N*A*M*E*>$/N; }
s/<\n*<\n*N\n*A\n*M\n*E\n*>\n
>/ **something** /;
'