#!/bin/sh FT_LINE1=7 FT_LINE2=15 FT_DIFF=$((FT_LINE2 - FT_LINE1)) cat /etc/passwd | # Not perfect, will discard line that contain a # # anywhere in the line, not just the beginning grep -v '#' | sed '1d' | awk 'NR % 2 == 1' | cut -d':' -f1 | rev | sort -r | head -"${FT_LINE2}" | tail -"${FT_DIFF}" | tr '\n' ':' | sed -e 's/:$/./g' -e 's/:/, /g'