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:
Why outputs end with ^M ? How can I solve that?