Free for all
This is a very simple PERL script that may be quite useful when working with delimited text files, especially for those of you who write/maintain Delimited Text drivers in IDM. You can use it in a few different ways:
- Convert a file from one delimiter to another
- Parse a file to make sure each field has quotes around it (instead of only those with spaces)
- Recreate your file but only specific columns
- Recreate your file with the columns in any order you want
- All of the above combined
If you’re good with the Linux command line tools, combine this script with grep, sed, awk, wc, etc. to do all sorts of things. I wrote it so that I could quickly look through a large CSV file I get from our HR system and return only the fields I want. For example, using this script and other built in tools I can quickly figure out how many active employees we have within a specific business unit without having to load the CSV into a database and query it that way.
The script was written for Linux, but seems to work in Windows too (tested using Active Perl base installation).
CSV Parser v1.0.2 - Parse data from a delimited text file. Usage: csvparser.pl -c [file] Required: -c | --csv [File] Specify a CSV with the input data Options: -i | --inputdelim [char] Input file delimiter (Default: ",") -o | --outputdelim [char] Output using different delimiter (Default: ",") -f | --fields [#,#,#,#] Fields to print (base 0) - Order will be maintained. (Default: All) -q | --quotes Include quotes around the fields (Default: Off) -h | --help Help! -d | --deubg Enable debugging info