Entering edit mode
3.5 years ago
nlt_220593
▴
20
I have a file.sh with the next commands:
#!/bin/bash
sed 1q file.txt > file_0.txt
grep -w "name" file.txt > file_1.txt
cat file_0.txt file_1.txt > final_file.txt
When I run: sh file.sh I obtain this error:
cat: file_0.txt: No such file or directory
cat: file_1.txt: No such file or directory
In the last command (cat) the files are not recognized because the final names are:
file_0.txt^M
file_1.txt^M
Why outputs end with ^M ? How can I solve that?
Somewhere during their journey, the files visited windows.