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)
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 on the file
As 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 more parameter as possible.
Take care, you will have to use nano or vim. Not Gedit or any other GUI editor
Name of file and strings must be used as argument or acquired in 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
That's the output of my version of the test...
./myversion.sh
Enter the name of the file to filter finaltest.txt
How many string 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 on each line the word , match
Found the word GATTACA on 3 lines
Found the word GATTACA a total of 4 times
Let's highlight all occurrencies of the word QUIGATTACICOVA
serena bio unina ATCGATTCCCGGAQUIGATTACICOVATCATGGATTCCAGTTTAAGGCCCCGATATCC
Now count on each line the word , match
Found the word QUIGATTACICOVA on 1 lines
Found the word QUIGATTACICOVA a total of 1 times
Max matches of word GATTACA is 4
Min match of string QUIGATTACICOVA is 1
What string do you want to replace? : GATTACA
What do you want to write instead of GATTACA : OBILAB
What is the file you wuold 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.