Problem in using Sed to remove leading and trailing spaces
Some older versions of sed don't understand C-style escape characters such as \t and treat that as two characters, '\' and 't'. You can avoid the problem by using a literal tab character -- if you're typing this directly into the shell, type Ctrl+V Tab
.
Another alternative, using whitespace character classes, if your variety of sed doesn't support \s
:
sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
You might have better luck if you just use the whitespace character class:
sed -e 's/^\s*//' -e 's/\s*$//' A.txt > B.txt