From unixformat Knowledge Base Wiki
Revision as of 01:17, 26 May 2021 by Admin (talk | contribs)
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