Question 1
In a proofreading task, it is usually required that each of the sentences in a manuscript should be numbered along with paragraph number. Write a bash script to print each sentence of a paragraph saved in sample.txt to a new line and add sentence number and paragraph number above each of the line.
Hint: One of the possible approaches is to use while loop along with IFS. This approach will need to remove leading and trailing spaces from line and add a fullstop at the end of each line.
Sample case
The plains are as flat as the proverbial pancake--a dead monotony of cultivated alluvium, square mile upon square mile of wheat, rice, vetch, sugar-cane, and other crops, amidst which mango groves, bamboo clumps, palms, and hamlets are scattered promiscuously. In some places the hills rise sheer from this, in others they are separated from the alluvial plains by belts of country known as the Tarai and Bhabar. The Tarai is low-lying, marshy land covered with tall, feathery grass, beautifully monotonous. This is succeeded by a stretch of gently-rising ground, 10 or 20 miles in breadth, known as the Bhabar--a strip of forest composed mainly of tall evergreen sal trees (Shorea robusta). These trees grow so close together that the forest is difficult to penetrate, especially after the rains, when the undergrowth is dense and rank. Very beautiful is the Bhabar, and very stimulating to the imagination. One writer speaks of it as "a jungle rhapsody, an extravagant, impossible botanical tour de force, intensely modern in its Titanic, incoherent magnificence." It is the home of the elephant, the tiger, the panther, the wild boar, several species of deer, and of many strange and beautiful birds.
Desired output
Paragraph 1, Statement 1:
The plains are as flat as the proverbial pancake--a dead monotony of cultivated alluvium, square mile upon square mile of wheat, rice, vetch, sugar-cane, and other crops, amidst which mango groves, bamboo clumps, palms, and hamlets are scattered promiscuously.
Paragraph 1, Statement 2:
In some places the hills rise sheer from this, in others they are separated from the alluvial plains by belts of country known as the Tarai and Bhabar.
Paragraph 1, Statement 3:
The Tarai is low-lying, marshy land covered with tall, feathery grass, beautifully monotonous.
Paragraph 1, Statement 4:
This is succeeded by a stretch of gently-rising ground, 10 or 20 miles in breadth, known as the Bhabar--a strip of forest composed mainly of tall evergreen sal trees (Shorea robusta).
Paragraph 1, Statement 5:
These trees grow so close together that the forest is difficult to penetrate, especially after the rains, when the undergrowth is dense and rank.
Paragraph 1, Statement 6:
Very beautiful is the Bhabar, and very stimulating to the imagination.
Paragraph 1, Statement 7:
One writer speaks of it as "a jungle rhapsody, an extravagant, impossible botanical tour de force, intensely modern in its Titanic, incoherent magnificence.
Paragraph 1, Statement 8:
" It is the home of the elephant, the tiger, the panther, the wild boar, several species of deer, and of many strange and beautiful birds.