by stevekemp · 1y ago · 0 comments
cat /etc/passwd | \
awk -v n=10 '{ lines[NR] = $0 }
END{
for (i = NR - n + 1; i <= NR; i++)
if (i > 0) print lines[i]
}'And there's also tail -f, how would you go about doing that? a while loop that sleeps and reopens the file? yuck