/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Let's say you want to get all lines from 4 to 10 in the file /etc/passwd: sed -n '4,10p' /etc/passwd Alternative: head -n 10 /etc/passwd | tail -n 6 or FIRST_LINE=4; LAST_LINE=10; head -n $LAST_LINE /etc/passwd |tail -n `echo "$LAST_LINE - $FIRST_LINE"|bc`