CSVfix: Windows/UNIX command-line tool for dealing with CSV data

CSV file extension logo


CSVfix is a command-line tool specifically designed to deal with CSV data. With it you can, among other things:

  • Reorder, remove, split and merge fields
  • Convert case, trim leading & trailing spaces
  • Search for specific content using regular expressions
  • Filter out duplicate data or data on exclusion lists
  • Enrich with data from other sources
  • Add sequence numbers and file source information
  • Split large CSV files into smaller files based on field contents
  • Perform arithmetic calculations on individual fields
  • Validate CSV data against a collection of validation rules
  • Convert between CSV and fixed format, XML, SQL and DSV

sample: Command line filter for random sampling of input written in C

Bicycle Silhouette



sample FILE              # randomly choose & print 4 lines from 
                         # file, in order
input | sample           # same, from stream (file defaults to 
                         # stdin)
sample FILE FILE2 FILE3  # randomly choose 4 lines between 
                         # multiple input files
sample -n 10 FILE        # choose 10 lines
sample -p 10 FILE        # 10% chance of choosing each line
input | sample -p 5      # randomly print 5% of input lines
input | sample -d a,b,c  # append input to files a, b, and c, 
                         # even odds
input | sample -d a,b,c, # append input to files a, b, c, or 
                         # /dev/null