Skip to content

Instantly share code, notes, and snippets.

@iegik
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save iegik/f8d037a64395a9d19d03 to your computer and use it in GitHub Desktop.

Select an option

Save iegik/f8d037a64395a9d19d03 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Adds column to CSV file
# addColumn.sh "field" "value" input.csv
TITLE=$1
VALUE=$2
INPUT=$3
OUTPUT=${INPUT%%.csv}"_fixed.csv"
sed '1!s/$/,"'$VALUE'"/;1s/$/,"'$TITLE'"/g' $INPUT > $OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment