windows系统txt文件
input.txt多行合并为一行
package mainimport ("fmt""io/ioutil""strings"
)func main() {content, err := ioutil.ReadFile("E:\\gin_demo\\demo30DNF\\youhua\\input.txt")if err != nil {fmt.Println("Error reading input file:", err)return}processedContent := strings.ReplaceAll(string(content), "\r\n", "")err = ioutil.WriteFile("E:\\gin_demo\\demo30DNF\\youhua\\output.txt", []byte(processedContent), 0644)if err != nil {fmt.Println("Error writing output file:", err)return}fmt.Println("Successfully removed newlines and saved to output.txt.")
}