Last active
September 24, 2021 10:27
-
-
Save adkdev/a3a54507084097af4e7eac23a49e753b to your computer and use it in GitHub Desktop.
Append string on each line to csv file
This file contains 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
# source : https://stackoverflow.com/a/66561835 | |
sed -E 's/'$'\r''?$/,"active"/' file.csv > out.csv |
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
Another solution using awk (in this case csv file has 5 columns)
awk -F"," 'BEGIN { OFS = "," } {$6="active"; print}' input.csv > output.csv