To display the last 100 words of a file, you can use a combination of tail and awk or rev commands. Here’s one way to do it using awk:
tail -n 0 filename | awk '{for(i=1;i<=NF;i++) words[NR,i] = $i} END {for(i=NR-99;i<=NR;i++) for(j=1;j<=NF;j++) if(words[i,j]) printf "%s ", words[i,j]; print ""}'
Alternatively, you can use rev to reverse the order of the words and then use head to get the first 100 words, followed by reversing it back:
rev filename | awk '{for(i=1;i<=NF;i++) print $i}' | head -n 100 | rev
Replace filename with the name of your file. This will display the last 100 words from the specified file.
