Sed

From unixformat Knowledge Base Wiki
Jump to navigation Jump to search

Instead of the cut command, use sed to remove the last 4 characters in a text file file1, number of characters determined by the number of ....s

sed "s/....$//" file1

or to print the last 4 characters

sed "s/.*\(....$\)/\1/" file1