Created
November 8, 2018 18:58
-
-
Save rms1000watt/4b46c90caa65127c3751c8ba9db266ed to your computer and use it in GitHub Desktop.
sed in OS X add newline at beginning of file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| header="col1,col2,col3" | |
| cat << EOF > raw.csv | |
| 4,1,5 | |
| 3,1,4 | |
| 6,8,11 | |
| EOF | |
| lf=$'\n'; sed -i.bak "1s;^;$header\\$lf;" raw.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment