I am trying read certain string output generated by linux command by the following code:
out, err := exec.Command(\"sh\", \"-c\", cmd).Output()
It's possible that your "\n" is actually the escaped version of a line break character. You can replace these with real line breaks by searching for the escaped version and replacing with the non escaped version:
strings.Replace(sourceStr, `\n`, "\n", -1)
Since string literals inside backticks can be written over multiple lines, Go escapes any line break characters it sees.