Skip to content

Instantly share code, notes, and snippets.

@tayeke
Created March 3, 2021 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tayeke/95975d4e44a992c147aa1982a40da175 to your computer and use it in GitHub Desktop.
Save tayeke/95975d4e44a992c147aa1982a40da175 to your computer and use it in GitHub Desktop.
Prepend a line to a bunch of CSVs in a folder
#!/bin/bash
cd "path/to/folder"
for file in *.csv; do
test -f "$file" || continue
echo "\"column one\",\"column two\" | cat - "$file" > "temp" && mv "temp" "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment