Regular expression help

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 7 months ago.

  • Author
    Posts
  • #5483

    by wolfeyes333 at 2013-01-29 11:30:35

    I'm trying to match the last number the string below which has to be equal to 1, can you please guide me how I can go about doing this. I want to search through logs and extract all the lines that end in the number 1 at the end of the string.

    acct-b-2013-01-29-0053.csv:d,2013-01-29 11:54:38-0500,2013-01-29 11:54:38-0500,,Diane@barmal.id,hi@koi.c,,relayed,2.0.0 (success),smtp;250 Queued (0.109 seconds),mail.i.com (74.206.170.28),,api,,smtp,13.22.21.1,74.06.10.2,"SIZE,AUTH,AUTH:LOGIN",6709,bal3038,1,1

    by ArtB0514 at 2013-01-29 11:35:27

    Match a string that ends in the numeral 1:
    $String -match "1$"

    See: http://msdn.microsoft.com/en-us/library/ms972966.aspx

    by wolfeyes333 at 2013-01-29 11:40:52

    Thanks for the response, if the match the string that ends in 1 then it may include string where the number after the last comma is for example 341 which is not what I want to include. I would want the string to match if the number after the last column is equal to 1. I'll check the link that you provided.

    by DonJ at 2013-01-29 12:03:51

    Then make it ",1$"

    by wolfeyes333 at 2013-01-29 12:11:12

    Thanks, I'll try that. You saved me a lot of time.

You must be logged in to reply to this topic.