Skip to main content
1 of 3
Costas
  • 15k
  • 24
  • 38

If you don't intend to make some operation with text the sed usage seems is more resonable

sed -En 's/.* (\S+)M$/\1/p'
Costas
  • 15k
  • 24
  • 38