+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
Scripts Thread, Powershell: Not having the same command 5 times just with different variables? in Coding and Web Development; Ah, my fault. That's a regex error. You actually want -notmatch ".*OK"...
  1. #16

    Join Date
    Mar 2008
    Location
    Surrey
    Posts
    2,209
    Thank Post
    114
    Thanked 331 Times in 273 Posts
    Blog Entries
    4
    Rep Power
    115
    Ah, my fault. That's a regex error. You actually want -notmatch ".*OK"

  2. #17


    Join Date
    Jan 2012
    Posts
    2,960
    Thank Post
    1,104
    Thanked 438 Times in 321 Posts
    Rep Power
    227
    That works!

    ... too well. It scans every line, right? So it includes the errors. The errors don't contain "OK", so it pulls them back (as Location) and the next line (the next light to be tested) flags as the Error. Whoops!

    So I get what I'm after, and then I end up with:
    Code:
       Error: Ftg.     1013   LocationRemoved   Warning
    
    ID Location               Error                                           
    -- --------               -----                                           
        ***** Check emergency Ftg.     1013   LocationRemoved   Warning
    
    
       Error: Ftg.     1050   LocationRemoved    Warning
    
    ID Location               Error                                           
    -- --------               -----                                           
        ***** Check emergency Ftg.     1050   LocationRemoved    Warning
    
    
       Error: Ftg.     1844   LocationRemoved    Warning
    
    ID Location               Error                                           
    -- --------               -----                                           
        ***** Check emergency Ftg.     1844   LocationRemoved    Warning
    
    
       Error: Ftg.     1846   LocationRemoved    Warning
    
    ID Location               Error                                           
    -- --------               -----                                           
        ***** Check emergency Ftg.     1846   LocationRemoved    Warning
    Ahah xD That certainly gave me a good chuckle

    Edit:Tried to use
    Code:
    $results = $report[16..-15]
    foreach ($item in ($results | Where {$_ -notmatch ".*  OK" -notmatch "`*"}))
    That didn't work either
    Last edited by Garacesh; 22nd November 2013 at 03:50 PM.

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 21st October 2013, 08:22 PM
  2. Why is GP applying but not at the same time???
    By abillybob in forum Windows Server 2008 R2
    Replies: 21
    Last Post: 5th September 2013, 10:23 AM
  3. iTALC Having the same workstation in multiple Classrooms
    By mitcheldrake in forum Network and Classroom Management
    Replies: 0
    Last Post: 2nd May 2011, 06:22 PM
  4. [Pics] Sometimes I Have The Same Response To Waking Up
    By DaveP in forum Jokes/Interweb Things
    Replies: 0
    Last Post: 18th March 2011, 10:57 AM
  5. Replies: 3
    Last Post: 1st September 2008, 10:30 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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