2

Hello everyone i want to know to cut the last field with separator : without knowing how many fields that i have any ideas please . is there any option for command cut .

2 Answers2

5

You can revert the string and then print 1st character. Itself cut can't work from backwards.

echo "Your string ABC" | rev | cut -c 1
Milan Dufek
  • 184
  • 7
2

Awk is the right tool for this. Try :

ls -lh  | awk '{ print $NF }'
Matias Barrios
  • 4,674
  • 3
  • 22
  • 49