The following code read the contents of a text file
#!/bin/bash filename='links.txt' while read -r line do echo $line done <"$filename"
To read first five lines only
head -5 dinks.txt | while read a; do echo $a; done
Read five lines and then delete those lines
head -5 links.txt | while read a; do echo $a; done sed -i "1,5 d" links.txt