Skip to content

Commit

Permalink
csvcat: a dumb utility for concatenating CSV files
Browse files Browse the repository at this point in the history
…that ignores the headers of subsequent files
  • Loading branch information
robmiller committed Mar 20, 2022
1 parent 6b9090b commit 317a47d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bin/csvcat
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
#
# Given one or more CSV files, concatenates them – assuming that the
# first row of each file is a header, and therefore that it shouldn't be
# repeated between files. It's quite dumb, and assumes that you're
# trying to concatenate CSV files that make sense shoved one after the
# other (i.e. they have the same columns in the same places.)
#
# Author: Rob MIller <r@robm.me.uk>

file = ARGV.shift
Process.spawn("cat", file)

ARGV.each do |file|
Process.spawn("tail", "+2", file)
end

0 comments on commit 317a47d

Please sign in to comment.