We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
How can I loop through the file starting at the end and going backward one line at a time? Can -tail be used for this? I do not want to read only the last 5 lines because I want to use a more complicated condition than the one above. Instead, I want to read the file backwards, starting at the last line then moving up one line at a time.
#!/bin/bash while read LINE do if [ $(( i )) -lt 5 ]; then i=$((i+1)) echo $LINE else break fi done <"$1"
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.