What is a unix command for deleting the first N characters of a line?

les2 picture les2 · Jun 9, 2009 · Viewed 284.6k times · Source

For example, I might want to:

tail -f logfile | grep org.springframework | <command to remove first N characters>

I was thinking that tr might have the ability to do this but I'm not sure.

Answer

iammichael picture iammichael · Jun 9, 2009

Use cut. Eg. to strip the first 4 characters of each line (i.e. start on the 5th char):

tail -f logfile | grep org.springframework | cut -c 5-