Issue
macOS. I'm trying to remove all dashes - from the end of lines in a file but I've not been able to do so. I've tried following commands so far and none worked
sed -e 's/^-//' -e 's/-$//' output.txt
cat output.txt | tr -d -
tr -d '[0-9-]' < output.txt
sed 's/[0-9-]//g' output.txt > output1.txt
Content of my file output.txt just for example
asfdsfds-
asdfdf-
sdfdes dsfds dsfds-
Solution
If your only requirement is indeed to remove all dashes from such input file, a single sed
such as below would be enough :
➜ ~ cat output.txt
asfdsfds-
asdfdf-
sdfdes dsfds dsfds-
➜ ~ sed -i '' 's/-//g' output.txt
➜ ~ cat output.txt
asfdsfds
asdfdf
sdfdes dsfds dsfds
➜ ~
Answered By - Dutch IT Answer Checked By - Cary Denson (WPSolving Admin)