Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
XP is just a number
 
PerlMonks  

Re: How to use long strings...

by bobn (Chaplain)
on Sep 03, 2003 at 04:42 UTC ( [id://288542]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How to use long strings...

if your format is really:

crud_GOOD_crud
Then you can split it out:
#untested for (split("\n", $content) ) # split string to multiple lines { my (undef, $good, undef) = split(/_/, $_); # could also be written as $good = ( split(/_/, $_) )[1]; $seen{$good}++; } for ( keys %seen ) { print "$_ $seen{$_}\n" }

--Bob Niederman, http://bob-n.com

All code given here is UNTESTED unless otherwise stated.

Replies are listed 'Best First'.
Re: Re: How to use long strings...
by zby (Vicar) on Sep 03, 2003 at 05:20 UTC
    The OP described the searched strings as rather "CRUD$left_string_GOOD_$right_stringCRUD" then just "crud_GOOD_crud". So you should split on /${left_string}_|_$right_string/.
Re: Re: How to use long strings...
by khelben (Initiate) on Sep 03, 2003 at 05:30 UTC
    Thank You,
    for (split("\n", $content))
    {
    $good = ( split(/logo_/, $_) )1;
    $good1 = ( split (/_20x/, $good) ) [0];
    $seen{$good1}++;
    }

    for ( keys %seen )
    {
    print "$_ $seen{$_}
    ";
    }
    works.
    Can I sort the output by the numbers?
    In the output is an number, witch i can not find with
    grep logo_ count.html | cut -d\, -f4 | sort | countfirstString.awk | sort -t\, -k2nr | less
      May be, the unknown number are the number of lines, witch do not contain the "/logo" and/or "_20x"?
      How can I fix this?
      Thank You,
      Roman

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://288542]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.