Basic bash commands. Use them to practice with the example file. Even when the example file seems to contain useless information, the commands will help you during the course to extract and format information from sequence files, even if they contain millions of lines. XXXXXXXXXXXXX aaaaa xxxxx xxxxx bbbbb ccccc xxxxx xxxxx ddddd eeeee xxxxx aaaaa bbbbb ddddd fffff axaxa bxbxb XXXXXXXXXXXXX Play with the following commands. If necessary, make changes to find out what they are doing. Remember to call the file only in the first command given: cat ejemplo.txt | grep "xxxxx" 0) Reading files + counting lines cat ejemplo.txt less ejemplo.txt (press q to exit) head -n3 ejemplo.txt tail -n2 ejemplo.txt cat ejemplo.txt | wc -l cat ejemplo.txt | uniq cat ejemplo.txt | sort | uniq cat ejemplo.txt | sort | uniq -c 1) grep grep "xxxxx" grep "xxxxx" | wc -l grep -v "x" grep -i "x" grep -o "aaaaa" grep -a2 "c" grep -A2 "c" grep -B2 "c" grep -E "aaaaa|ccccc" -> What would you write to find lines that contain both "a" and "b"? 2) Understanding regular expressions. grep "^x" grep "x$" grep "aaaaa..." #How many characters are highlighted?# grep "a*" grep "a.*" grep "a[^a]" grep "a[ax]" Regular expressions can be combined with the previous options, particularly with -o to extract characters after a pattern. -> Try extracting only the first 3 characters of lines that start with "a" 3) sed sed s/x/i/ sed s/x/i/g sed s/axaxa/kkkkk/ Combine with regular expressions. -> Try converting the first 3 characters into "iii" sed + special characters (An special character might be ) sed s/\t// sed -e 's/\t//' 4) cut cut -f2 -> Extract the first column of lines that contain "d" 5) Save/overwrite output (ACHTUNG: do not give same name as input file) cut -f2 ejemplo.txt > copy_ejemplo.txt To save without overwriting (lines get added to file): grep "X" ejemplo.txt >> copy_ejemplo.txt 6) both files vs for-loop grep "xxxxx" ejemplo.txt | wc -l grep "xxxxx" copy_ejemplo.txt | wc -l cat *plo.txt | wc -l for i in *plo.txt; do echo $i; done for i in *plo.txt; do cat $i | wc -l; done 7) translate cat ejemplo.txt | tr -d '\n'