I have a CSV file that looks like this:
Wave 1,bob,IL
Wave 2,julia,CO
Wave 1,mark,WA
Wave 2,fred,AK
I want to change it to look like this:
Wave 1,bob
Wave 2,julia
Wave 1,mark
Wave 2,fred
I can use use cut -d ',' -f 1-2 test.csv
to produce this result in stdout but I need to output to the same file being cut. I have tried cut -d ',' -f 1-2 test.csv > test.csv
and stdbuf -o0 cut -d ',' -f 1-2 test.csv > test.csv
but they both produce blank test.csv files.
How can I remove everything after the second comma on a per line basis, and write the result in-place?