Say you have a txt file, what is the command to view the top 10 lines and bottom 10 lines of file simultaneously?
i.e. if the file is 200 lines long, then view lines
Based on J.F. Sebastian's comment:
cat file | { tee >(head >&3; cat >/dev/null) | tail; } 3>&1
This way you can process first line and the rest differently in one pipe, which is useful for working with CSV data:
{ echo N; seq 3;} | { tee >(head -n1 | sed 's/$/*2/' >&3; cat >/dev/null) | tail -n+2 | awk '{print $1*2}'; } 3>&1
N*2 2 4 6