I needed to get only first and last line from a file (actually, not a file, but rather output from another command).
head -1 and
tail -1 can be used to get either first or last, but how to combine the two at the same time? Here’s how. Enter
cat somefile | grep something | tee >(head -1) >(tail -1) > /dev/null