paperjam

second-to-last.sh

Oct 12th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.23 KB | None | 0 0
  1. #!/usr/bin/env /bin/bash
  2.  
  3. pth="${HOME}/path/to/files"
  4. fls=( $( ls "${pth}" ) )
  5.  
  6. for fl in ${fls[@]} ; do
  7.   tf="${pth}/${fl}"
  8.   if [[ -f "${tf}" ]]; then
  9.     printf "FILE: %s \n" "${fl}"
  10.     tail -n 2 "${tf}" |head -n 1
  11.   fi
  12. done
Advertisement
Add Comment
Please, Sign In to add comment