I'm trying to execute the following command via Go:
cut -f1 -d $'\t' fileName | sort | uniq -d
My code:
log.Printf("%s %s %s %s %s %s", "cut", "-f1", "-d ", "$'\\t'", fileName, " | sort | uniq -d")
r, e = exec.Command("cut", "-f1", "-d", "$'\\t'", sortedFile, " | sort | uniq -d").CombinedOutput()
log.Printf("o/p:%d", string(r))
This gives a bad delimiter error but the command printed runs on command line
Log snippet:
2020/09/17 13:27:13 cut -f1 -d $'\t' /Users/samalhot/Documents/test_sorted.txt | sort | uniq -d
2020/09/17 13:27:13 o/p:%!d(string=cut: bad delimiter
)
What am I doing wrong?