I need to process a large number of files in a directory. The files can be partitioned into several groups, based upon the file names. That is to say, the file names can be pattern matchedne which 'group' they belong to. For instance, the names are like this:
- YYYYMMDD_*_bulk_import.csv
- YYYYMMDD_*_genstats_import.csv
- YYYYMMDD_*allstats.csv
etc ...
Each 'group' has a different processing methodology (i.e. a different command is called for processing).
I want to write a bash script to:
- Iterate through all CSV files in the directory
- Determine which 'group' a file belongs to by pattern matching its name to known patterns (like the examples I gave above)
- Call a command based on the determined grouping.
I am running on Ubuntu 10.0.4. I am new to bash, and would appreciate skeleton code snippet that will help me get started in writing this script.