Gli esami non finiscono mai

Mi sono scocciato di sottostare alla legge del vivere civile che ti assoggetta a dire sì senza convinzione quando i no, convintissimi, ti saltano alla gola come tante bolle d'aria.
(Eduardo De Filippo)

LinuxBanner

Final Test

Check the content of the file finaltest.txt, then
You need to check how many occurrences of more than one string happens into the file.
Look for the string GATTACA and QUIGATTACICOVA
Count the quantity of each matched pattern and at the end report the most frequent string in the file
As a last step, look for a string, for example, GATTACA, and replace it with the string OBILAB. You can develop the script top-down, but if you feel particularly skilled... I would like to remind you to use functions and to check as many parameters as possible.
Take care, you will have to use nano or vim. Not Gedit or any other GUI editor
The name of the file and strings must be used as arguments or acquired via standard input



cat finaltest.txt This file is for final test. stefano IT unina GATTACAGACTACTTAAGCTACTTGCTACAAACTAACTGGTTACAAATAGATAGATAG marco bio unina GATTACAGACTACTTAAGCTACGATTACAAAACTAACTAAGCTACGATTAAAGCTACGG mario IT igb GATTACAGACTACTTAAGCTACTTGCTACAAACTAACTAAGCTACGATTAAAGCTACGTCGC serena bio unina ATCGATTCCCGGAQUIGATTACICOVATCATGGATTCCAGTTTAAGGCCCCGATATCC

Here is the output of my version of the test...


./myversion.sh Enter the name of the file to filter finaltest.txt How many strings do you want to search? : 2 You've entered the Integer: 2 Insert the string 0 : GATTACA Insert the string 1 : QUIGATTACICOVA Let's highlight all occurencies of the word GATTACA stefano IT unina GATTACAGACTACTTAAGCTACTTGCTACAAACTAACTGGTTACAAATAGATAGATAG marco bio unina GATTACAGACTACTTAAGCTACGATTACAAAACTAACTAAGCTACGATTAAAGCTACGG mario IT igb GATTACAGACTACTTAAGCTACTTGCTACAAACTAACTAAGCTACGATTAAAGCTACGTCGC Now count the matches of the word on each line Found the word GATTACA on 3 lines Found the word GATTACA a total of 4 times Let's highlight all occurrences of the word QUIGATTACICOVA serena bio unina ATCGATTCCCGGAQUIGATTACICOVATCATGGATTCCAGTTTAAGGCCCCGATATCC Now count the matches of the word on each line Found the word QUIGATTACICOVA on 1 lines Found the word QUIGATTACICOVA a total of 1 times Max matches of the word GATTACA is 4 Min matches of the string QUIGATTACICOVA is 1 Which string do you want to replace? : GATTACA What do you want to write instead of GATTACA : OBILAB Which file would you like to edit? (irreversible) : finaltest.txt Verifica file di Log per il risultato shady@debian8vm:~/obiDir$

That's my version of the final test, feel free to use my functions as you prefer.