Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Huh, looking at this made me notice something; the trailing spaces you're removing, which I thought were just a refuse in OP's example, may actually be the "tabs" I now notice they're mentioning at the end of the question. +1 as this is the correct solution given the proposed input, however OP should clarify this. Commented Aug 30, 2024 at 5:12
  • 1
    Thank you. awk 'BEGIN{FS=OFS=","} {sub(/ +$/,"")} NR==1{gsub(/ /,FS)} NR>1{$1="\""$1"\""} {print $2, $3, $1}' pc0.csv > pc1.csv worked perfectly. Commented Aug 30, 2024 at 17:54