Ubuntu 16.04
Bash 4.3.3
I also need a way to add a space after the comma if one does not exist in the 6th column. I had to comment the above line because it placed a space after all commas in the csv file.
Wrong: "This is 6th column,Hey guys,Red White & Blue,I know it,Right On"
Perfect: "This is 6th column, Hey guys, Red White & Blue, I know it, Right On"
I could almost see awk
printing out the 6th column then having sed
do the rest:
awk '{ print $6 }' "$feed " | sed -i 's/|/,/g; s/,/, /g; s/,\s\+/, /g'
This is what I have so far:
for feed in *; do
sed -r -i 's/([^,]{0,10})[^,]*/\1/5' "$feed"
sed -i '
s/<b>//g; s/*//g;
s/\([0-9]\)""/\1inch/g;
# s/|/,/g; s/,/, /g; s/,\s\+/, /g;
s/"one","drive"/"onetext","drive"/;
s/"comments"/"description"/;
s/"features"/"optiontext"/;
' "$feed"
done
s/|/,/g; s/,/, /g; s/,\s\+/, /g;
works but is global and not within a column.