in reply to Re^2: Bolt on where a match is not found to a print script
in thread Bolt on where a match is not found to a print script

Hmmm. Yes, you could well be right about each one requiring a separate flag, although that's not how I originally read the requirement. At least our anonymous brother has 2 marginally differing approaches to choose between. The whole thing does have something of an XY ring to it. Perhaps we'll find out.

  • Comment on Re^3: Bolt on where a match is not found to a print script

Replies are listed 'Best First'.
Re^4: Bolt on where a match is not found to a print script
by Anonymous Monk on Dec 05, 2017 at 13:05 UTC

    Thank you so much guys.. so the primary function of the code is to search through the text files in the folder and print every line that includes a the exact match to the number (contained within the line). the secondary requirement is that IF after searching through all the files no single match is found of the number then print at the bottom that it was not matched

    this is a sample of the data:

    Port Name Status Vlan Duplex Speed Fa0/1 Sohnsons connected 1404 full 100 Fa0/2 Sohnsons connected 1404 full 100 Fa0/3 XYZ connected 1221 full 100 Fa0/4 Sohnsons notconnect 1404 full 100

    If you searched the files for 3 number (1404,1221,1234) 1234 would not be matched and printed, thus we would want "1234 not matched" printed. The code you presented worked really well for a single search, but we need to search multiple values

      Thanks for this clarification. In that case, QM's solution should be precisely what you need. Try that and see how you get on.