Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    96
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Simple parsing script help

    Hey all, I have a simple script I'd like modifying, just figure someone here might be able to help before I try and figure it all out myself.

    Original:
    lynx -source "http://a_web_page" | grep "TrCall(\"3\"" | awk {'print $3" "$4" "$6'} | sed -e "s/\"//g" -e "s/,//g" > /tmp/a_log_file
    Run on a page containing, among other things,

    <script type="text/javascript">document.write(TrCall("2", "24.06.08 13:55", "", "019041111111", "", "0", "1", "0:00"));</script>
    <script type="text/javascript">document.write(TrCall("3", "24.06.08 13:54", "", "10000", "0", "0", "1", "0:01"));</script>
    Gives me a file with:

    24.06.08 13:54 10000
    What I'd like is, aswell as grabbing the stats based on the first quoted number "1", "2" or "3" (in this case only 3 is recorded), I'd like to do it based on the 6th quoted number too (bold in the above text), which is either "", "0" or "1". I'd like to record only those with "".

    Thanks to anyone who can advise how


    UPDATE:
    There's gotta be a more efficient way than this?
    grep "TrCall(\"3\"" | awk {'print $3" "$4" "$6" "$8'} | grep "\"\"" | sed -e "s/\"//g" -e "s/,//g"
    Last edited by pepsi_max2k; 06-24-2008 at 02:14 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •