Skip to content

Instantly share code, notes, and snippets.

@adkdev
Last active September 24, 2021 10:27
Show Gist options
  • Save adkdev/a3a54507084097af4e7eac23a49e753b to your computer and use it in GitHub Desktop.
Save adkdev/a3a54507084097af4e7eac23a49e753b to your computer and use it in GitHub Desktop.
Append string on each line to csv file
# source : https://stackoverflow.com/a/66561835
sed -E 's/'$'\r''?$/,"active"/' file.csv > out.csv
@adkdev
Copy link
Author

adkdev commented Sep 24, 2021

If you need to add new column between column 4 and 5 use this (csv file has 7 columns)
awk -F"," 'BEGIN { OFS = "," } {print $1 OFS $2 OFS $3 OFS $4 OFS "__AAA__" OFS $5 OFS $6 OFS $7}' input.csv > output.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment