mercredi 25 février 2015

Last n words from a string in bash

I have a string containing many (the total number varies) words, and I need to get last 10 of them. How do I do it? I'm looking at awk, grep and cut but nothing really comes to mind.


An example (although it seems to me that the question is clear):



aaa bda fdkfj fds fsd ... dsad dsas dsad zrthd shshh


I want the last 10 words of this string.


Again, the total number of words in the initial string isn't defined.


Aucun commentaire:

Enregistrer un commentaire