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.
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** ```text 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** ```text 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. ``` A file `mydata.csv` is present in the current working directory. Use sed to swap the fourth column to the first column. **Sample input** ```text grep,219,10.95,47961 ls,208,10.4,43264 echo,195,9.75,38025 ps,92,4.6,8464 sed,82,4.1,6724 cd,80,4,6400 vi,77,3.85,5929 clear,72,3.6,5184 awk,72,3.6,5184 man,67,3.35,4489 ``` **Sample output** ```text 47961,219,10.95,grep 43264,208,10.4,ls 38025,195,9.75,echo 8464,92,4.6,ps 6724,82,4.1,sed 6400,80,4,cd 5929,77,3.85,vi 5184,72,3.6,clear 5184,72,3.6,awk 4489,67,3.35,man ``` A file sample.txt contains multiple paragraphs. As it is a text file, discerning paragraphs could be tricky. To resolve this user wanted to add '---' before and after each paragraph. Write a **sed script** which will accomplish that. **Sample Input** ```text 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. ``` **Sample Output** ```text --- 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. --- ```