I'm trying to remove digits from the end of each line within a text file, I've tried using:
sed 's/[0-9]\+$//' <input.txt >output.txt
but it doesn't work, however if I a echo input, ie
echo "Bla1Bla123" | sed 's/[0-9]\+$//'
it will work correctly and output as expected
Bla1Bla
removing " 123 " from the end.
however when I try using input.txt it fails to do that for each line..
example of input.txt is
heyexample1:123example123
h123h:i123i123
which should then output
heyexample1:123example
h123h:i123i
instead it makes no alterations
Your files are probably encoded with the \r\n
line endings (since you are on Windows). Try 's/[0-9]\+\r$/\r/'
replace command (preserving the \r
intentionally).
There might be a way for sed to handle CRLF line endings, but I cannot find it after a brief search.