You can get the lines you want from the command paste:
$ paste -d, starting ending
15,22
30,35
45,50
You can use this with the command sedas follows:
while read range
do
sed -n "${range}p" file
done < <(paste -d, starting ending)
The design <(...)is called process replacement. The space between the two <is significant.
source
share