shell - regex of string -



shell - regex of string -

i want set value of percentcomplete in jobstatus in variable utilize later in shell script. info goes txt file , continually prints these 2 paragraphs updating data. want able percentcomplete. have cat txt file don't know regular look utilize percentcomplete (the 1 within jobstatus).

<batchstatus name="" submissiontime="1/23/12 10:00:26 am" sentby="mike" timeelapsed="43 second(s)" timeremaining="4 minute(s)" timeelapsedseconds="43" timeremainingseconds="294" percentcomplete="12" resumepercentcomplete="0" status="processing" batchid="fd66dc21-6aa4-47fb-a3f0-7300c7bdab8a" /batchstatus> <jobstatus name="file.mov" submissiontime="1/23/12 10:00:26 am" sentby="mike" jobtype="compressor" priority="highpriority" timeelapsed="43 second(s)" timeremaining="4 minute(s)" timeelapsedseconds="43" timeremainingseconds="294" percentcomplete="12" resumepercentcomplete="0" status="processing: transcoding" jobid="fdf1a488-51b9-4b9a-908b-fd5d95ce7e92" batchid="fd66dc21-6aa4-47fb-a3f0-7300c7bdab8a" /jobstatus>

it's bad thought utilize regex this, you'd much happier using xml parser.

if still want to:

<jobstatus[^>]*percentcomplete="([\d]+)"

regex shell unix

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -