Reputation: 397
I have this line:
\\Server1\A Share & Test & Check M
I want this output:
\\Server1\A Share & Test & Check
It should end with a character and not spaces (\\Server1\A Share & Test & Check)
I tried this:
sed -i "s/[ *\t[a-z]]*$//I" shares.txt
It removes the last letter but not the spaces.
Upvotes: 0
Views: 72
Reputation: 19733
try this
echo "\\Server1\A Share & Test & Check M" | sed 's/[\tA-Za-z]*$//g'
output:
echo "\\Server1\A Share & Test & Check
Upvotes: 1
Reputation: 103965
The regex you are after is \s*[a-z]*$
sed -i "s/\s*[a-z]*$//I" shares.txt
\s
is for any white space character
Upvotes: 1