I am trying to apply this command sed -i -e 's/\\r$//'
to all Shell ( .sh
) files in my directory I have tried:
sed -i -e -R 's/\r$//' *.sh
But this throws an unknown character error.
Any help would be great cheers!
This is an argument order issue. -e
expects the expression/script as the next argument and you are giving it -R
.
Swap those two arguments sed -i -e '....'
.
That being said the dos2unix
program exists for this purpose as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.