print first and last row

view story

http://www.unix.com – Hello everybody, I would like to ask you, how to print first and last row from input (not file). I want to get first and last name of file from directory sorted by name, which contains files e.g: ab.txt fg.txt bc.txt and the output should be ab.txt and fg.txt. I used something like this Code: find ./ -maxdepth 2 -mindepth 2 print | awk -F"/" '{ print $NF }' | sort -n and I try to get output like to print first and last line from file, but it gave me only one value instead of two values. Thank you for your help. s. (HowTos)