Linux tail only whole words

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-04-10T11:35:27Z Indexed on 2010/04/10 11:43 UTC
Read the original article Hit count: 401

Filed under:
|

Hello, I need to print last 20 characters of string, but only whole words. Delimiter is a space "". Let's consider this example:

string="The quick brown fox jumps over the lazy dog"
echo $string | tail -c20

returns s over the lazy dog. And I need it to return over the lazy dog instead. Do you know how to accomplish that? Thanks!

© Stack Overflow or respective owner

Related posts about tail

Related posts about bash