mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 10:36:28 +00:00
20 lines
313 B
Bash
Executable File
20 lines
313 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
die() {
|
|
echo "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
file=$1
|
|
from=$2
|
|
to=$3
|
|
|
|
start_line=$(grep --line-number "$from" $file | cut -d':' -f1)
|
|
if [ -z "$start_line" ]; then
|
|
die "Cannot find $from in $file"
|
|
fi
|
|
|
|
tail -n +$start_line $file | awk "BEGIN { getline; print \$0 } /$to/ { exit } { print }"
|
|
|
|
exit $?
|