Re: Regex To get the Job Number and Corresponding state

[email protected] (Dermot) Tue, 25 Feb 2025 17:47:28 +0000
Newsgroups perl.beginners
Message-ID <CAK+UtvJOxnxs6U3huh92iXLhgnSTH5N_eUtvBZSXT-ht1fK9XA@mail.gmail.com>
--0000000000009b2151062efb0dec
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

What is the record separator? How can we tell `Job ID: 52` from `Job ID:
51`?

The input record separator is newline by default. If you want the Job ID of
the records where status=3DSUCCEEDED, you'll need to set the record separat=
or
to something other than "\n" and do a multi-line search.`/m`.
I think we'd need to see more of the data to help further.
Dermot




On Tue, 25 Feb 2025 at 17:15, Asad <[email protected]> wrote:

> The problem with grep is that line numbers may change so even if i do gre=
p
> -E   SUCCEEDED|"\ "ZDM_SETUP_TGT\"" -B5 , it may not alway 5 line above
> or is there a more better way in grep or regex
>
>
> On Tue, Feb 25, 2025 at 10:22=E2=80=AFPM Erick Paquin <[email protected]=
om>
> wrote:
>
>> You can use grep for this..
>>
>> ---
>> Erick Paquin
>>
>> On 25/02/2025 11:49 am, Asad wrote:
>> > Hi All,
>> >
>> > I have a requirement to use regex  , find the Job ID for the Current
>> > status: SUCCEEDED and Current Phase: "ZDM_SETUP_TGT" from a file
>> > which has data in the format gives below :
>> >
>> > Job ID: 52
>> > User: zdmuser
>> > Client: zdmhost
>> > Job Type: "EVAL"
>> > ...
>> > Current status: SUCCEEDED
>> > Current Phase: "ZDM_SETUP_TGT"
>> >
>> > Thanks,
>>
>
>
> --
> Asad Hasan
> +91 9582111698
>

--0000000000009b2151062efb0dec
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>What is the record separator? How can we tell `Job ID=
: 52` from `Job ID: 51`?</div><div><br></div><div>
The input record separator is newline by default.

If you want the Job ID of the records where status=3DSUCCEEDED, you&#39;ll =
need to set the record separator to something other than &quot;\n&quot; and=
 do a multi-line search.`/m`. <br></div><div>I think we&#39;d need to see m=
ore of the data to help further.</div><div>Dermot</div><div><br></div><div>=
<br></div><div><br></div></div><br><div class=3D"gmail_quote gmail_quote_co=
ntainer"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, 25 Feb 2025 at 17:15=
, Asad &lt;<a href=3D"mailto:[email protected]">asad.hasan2004@gmail=
.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex"><div dir=3D"ltr">The problem=C2=A0with grep is that line numbers may ch=
ange so even if i do grep -E=C2=A0=C2=A0

<span style=3D"color:rgb(0,0,0);font-family:Monaco,Consolas,&quot;Bitstream=
 Vera Sans Mono&quot;,&quot;Courier New&quot;,Courier,monospace;font-size:1=
6px">SUCCEEDED|&quot;\</span>

<span style=3D"color:rgb(0,0,255);font-family:Monaco,Consolas,&quot;Bitstre=
am Vera Sans Mono&quot;,&quot;Courier New&quot;,Courier,monospace;font-size=
:16px">&quot;ZDM_SETUP_TGT\&quot;&quot; -B5  , it may not alway 5 line abov=
e or is there a more better way in grep or regex</span><div><span style=3D"=
color:rgb(0,0,255);font-family:Monaco,Consolas,&quot;Bitstream Vera Sans Mo=
no&quot;,&quot;Courier New&quot;,Courier,monospace;font-size:16px"><br></sp=
an></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gma=
il_attr">On Tue, Feb 25, 2025 at 10:22=E2=80=AFPM Erick Paquin &lt;<a href=
=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You =
can use grep for this..<br>
<br>
---<br>
Erick Paquin<br>
<br>
On 25/02/2025 11:49 am, Asad wrote:<br>
&gt; Hi All,<br>
&gt; <br>
&gt; I have a requirement to use regex=C2=A0 , find the Job ID for the Curr=
ent<br>
&gt; status: SUCCEEDED and Current Phase: &quot;ZDM_SETUP_TGT&quot; from a =
file<br>
&gt; which has data in the format gives below :<br>
&gt; <br>
&gt; Job ID: 52<br>
&gt; User: zdmuser<br>
&gt; Client: zdmhost<br>
&gt; Job Type: &quot;EVAL&quot;<br>
&gt; ...<br>
&gt; Current status: SUCCEEDED<br>
&gt; Current Phase: &quot;ZDM_SETUP_TGT&quot;<br>
&gt; <br>
&gt; Thanks,<br>
</blockquote></div><div><br clear=3D"all"></div><div><br></div><span class=
=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_s=
ignature"><div dir=3D"ltr">Asad Hasan<br>+91 9582111698</div></div>
</blockquote></div>

--0000000000009b2151062efb0dec--