Python Forum
Search multiple CSV files for a string or strings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search multiple CSV files for a string or strings
#1
So i have a need to be able to search multiple CSV files for a string or set of strings and then return the file name that it was found in.

I want to keep it as general as possible so that the search can be performed for anything within the files.

All files will reside in 1 folder, because they are named with the dates in the file name like so:
Future_Matched_2022-02-19 to 2022-02-23.csv
Future_UnMatched_2022-02-19 to 2022-02-23.csv

The folder contains 2 files per day, all the way back to november, not that it matters, but to give context on how many files there currently are and to understand that there will be plenty more by the end of the year..

So my need is to build some script that i can plug in a value (numerical for this first iteration) 6 digit number

130062 example...

Using that number, i need to search each file in the folder, and if its found in any file, then provide a list of all the files that number was found in so we can pull those files out and investigate further.

so before i go down the rabbit hole of trying all sorts of things.. what should i start with? methods to consider and use?
What's most efficient for such a search? im not super concerned with speed now, but if i can script it so its quick now and later when there is a years worth of files to look thru that would be great.

Any guidance would be great on where or what i should consider to start with. Keeping in mind that i dont have to do anything else with the files, just need to find any files that contain the string provided.
Reply


Messages In This Thread
Search multiple CSV files for a string or strings - by cubangt - Feb-21-2022, 04:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to generating multiple json files using python script dzgn989 4 325 May-10-2024, 03:09 PM
Last Post: deanhystad
  Writing a Linear Search algorithm - malformed string representation Drone4four 10 1,185 Jan-10-2024, 08:39 AM
Last Post: gulshan212
  python convert multiple files to multiple lists MCL169 6 1,725 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Search for multiple unknown 3 (2) Byte combinations in a file. lastyle 7 1,542 Aug-14-2023, 02:28 AM
Last Post: deanhystad
  Trying to understand strings and lists of strings Konstantin23 2 899 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  splitting file into multiple files by searching for string AlphaInc 2 1,027 Jul-01-2023, 10:35 PM
Last Post: Pedroski55
  xml indent SubElements (wrapping) with multiple strings ctrldan 2 1,652 Jun-09-2023, 08:42 PM
Last Post: ctrldan
  Merging multiple csv files with same X,Y,Z in each Auz_Pete 3 1,303 Feb-21-2023, 04:21 AM
Last Post: Auz_Pete
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 1,020 Feb-15-2023, 05:34 PM
Last Post: zsousa
  Find duplicate files in multiple directories Pavel_47 9 3,396 Dec-27-2022, 04:47 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020