#! /bin/bash
# Last edited on 2017-07-28 10:52:19 by jstolfi

# Usage: show_first_chars.sh {FILE}..

# Prints the name of each {FILE} followed by its first few 
# printable non-blank ascii chars.

files=( "$@" )

for f in "${files[@]}" ; do
  if [[ -f ${f} ]]; then
    printf "${f}: «"
    cat ${f} | head -c 32 | tr -c -d '!-[]-~'
    printf "»\n"
  else
    echo "** ${f} does not exist or is not a file" 1>&2
  fi
done
