Nguyễn Thị Lan
New member
How do you remove the last two characters in UNIX?
Answer
I have two solutions :
Answer
I have two solutions :
- cut: echo “somestring1” | rev | cut -c 2- | rev. Here you reverse the string and cut the string from 2nd character and reverse again.
- sed : echo “somestring1” | sed ‘s/.$//’