Allows printing a large file by giving a line range
Helpfull when you have a large file that can't be loaded into a text editor but you want to inspect it
./print_lines.sh FILE START_LINE END_LINE
./print_lines.sh ./some-large-file.xml 1000 2000
END_LINE=$3 | |
START_LINE=$2 | |
NUM_LINES=$(($END_LINE - $START_LINE)) | |
HEAD_LINE=$(($START_LINE + $NUM_LINES)) | |
echo "LINES $START_LINE-$END_LINE" | |
head -n $HEAD_LINE "$1" | tail -n $NUM_LINES |