Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello Monks, I am seeking perl wisdom. I have a text file in format:

APP> LumaIntraMode :D45_PRED, use_intrabc:0 AED> Dif: 80369151, Rng: 34624, Cnt: 10, Ret: 6 AED> Dif: 642953215, Rng: 52408, Cnt: 7, Ret: 13 APP> ChromaIntraMode :UV_CFL_PRED AED> Dif: 22413311, Rng: 36032, Cnt: 2, Ret: 5 AED> Dif: 115632447, Rng: 63232, Cnt: 11, Ret: 3 APP> ALPHA_U: 48, ALPHA_V: 0, CFL_ALPHA_SIGN: 5, CFL_ALPHA_IDX: 4 +8 APP> IntraAngleDelta : 3 0

I am trying to order print statements after grepping information from above text file.

if ($line =~ /\s*APP>\s*LumaIntraMode\s:(\w+),\suse_intrabc:(\d)/i) { print "Luma_mode = $1\n"; } if ($line =~ /\s*APP>\s*ChromaIntraMode:\s(\w+/i) { print "Chroma mode: $1\n"; } if ($line =~ /\s*ALPHA_U: (\d+), ALPHA_V: (\d+), CFL_ALPHA_SIGN: 5/i) +{ print "CFL : $3\n"; } if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Luma Angle : $1\n" } if ($line =~ /\s*APP>\sIntraAngleDelta\s:\s(\d+)\s(\d+)/i) { print "Chroma Angle : $2\n" }

I am getting output as: <\p>

Luma Mode: D45_PRED Chroma Mode: UV_CFL_PRED CFL: 5 Luma Angle: 3 Chroma Angle: 0

Can anyone suggest logic to print the above output in following order (changing ordering of print statement):

Luma Mode: D45_PRED Luma Angle: 3 Chroma Mode: UV_CFL_PRED CFL: 5 Chroma Angle: 0

I would really appreciate any help.


In reply to Ordering of print statements by Eshan_k

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found