Tech, Gadgets, Photography, Social Media and Poor Spelling
I needed to get only first and last line from a file (actually, not a file, but rather output from another command).
tail -1can 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