Lab04
Lab04
to CS
College of Engineering Lab. Section
Department of Computer Science & Engineering Fall 2024
RegEx Syntax
Preparation
Page 1 of 5
CMPS 101 / Lab Section / Fall 2024 / © Amelle Bedair
Task#1: Har d Linked Files
Note: For all commands, never move out from lab04 directory, it should always be the working
directory, i.e. never use the cd command again.
1. Run vim hello.txt command. In the editor, enter the “Hello” and “How are you”, each on a
separate line. Then, save and close
vim dir1/hello.txt
2. Run the tree command
3. List the properties of the hello.txt file. How much is the link count?
ln dir1/hello.txt dir2/
6. List the properties of the dir1/hello.txt file. How much is the link count?
Page 2 of 5
CMPS 101 / Lab Section / Fall 2024 / © Amelle Bedair
7. List the properties of the dir2/hello.txt file. How much is the link count?
9. With the Vim editor, add the “Have a nice day” line to the hello.txt located in dir1 directory.
Save and close.
cat dir1/hello.txt
cat dir2/hello.txt
11. With the Vim editor, add "===========" at the top and bottom lines to the hello.txt located in
dir2 directory. Save and close.
12. Display the contents of both hello.txt files. Are they identical?
cat dir1/hello.txt
cat dir2/hello.txt
1. With Vim, create the bad.txt file. Type your name and hit Ctrl+ZZ instead of Shift+ZZ. On the
Terminal, you will see [1]+ Stopped vim bad.txt
2. Try to run the vim bad.txt command. Vim will display the following message “Found a swap
file by the name ".bad.txt.swp" which means that Vim detected an incomplete session from a
previous edit of the same file. This usually happens when Vim is not closed properly.
3. Enter the tree command with the -a option to see the swap hidden file.
5. Run the vim bad.txt command. Vim will open but with no text, because in step-1, you
incorrectly closed the Vim.
Page 3 of 5
CMPS 101 / Lab Section / Fall 2024 / © Amelle Bedair
Task#3: File Access Per mission
1. Use the tree command with the -p option to see the permission of each file
4. Use the Octal way, in one command, set the permission of dir2/hello.txt as indicated;
Task#4: Piping
1. Run Vim with colors.txt file name. Then copy-and-paste the following data
Blue,carpet
Red,chair
Red,window
green,sofa
Blue,lamp
Green,picture frame
red,table
Red,cups
blue,board
3. In one pipe, create the command sequence to print the least used color; i.e. 2 green
Note: build the command line in sequence to observe the result of each step.
Page 4 of 5
CMPS 101 / Lab Section / Fall 2024 / © Amelle Bedair
Task#5: Processing FASTQC File
@fqlib5:334:VVDJXFE:4:5:7053:1012/1
CCTTTTCCCGCAGTCGTCAGCAGTAAGTGTGCGACCGGTAGTTCAAAAGGGGAATATCACCCGCTATTTTGCGAATACTAG
AGCCTCGGTTCACGCAAGCA
+
GFGDDB@CJCHDBDBDB@JACCIE@J@GD@FHFADAIEA@@ABBEADHBFH@CIEFBBHGCHEJHEAIHAAIHBGEH@EDG
AEEC@FGEABAHE@FAI@IC
@fqlib5:334:VVDJXFE:7:33:2310:7985/1
ACGTGGCCGTCCTTTTGCCAGATATCGGTAAGAGAGTTCTAGCTAAGATAATATCAATCCGCGAATGTCAGAGGGAGTGTT
TCCCTTCCGGGGAAGCAAAT
+
GDGE@DBJJCBHCGFEBHDGEI@JA@GHEHA@CCJGCGGDJGBACIBGECDDBGBHI@GBAEBBJD@@BAFBHAHEHJCBG
FGCA@GJ@IAAIJDHG@IDC
2. Run the cat -n dna.fstq command. You should see only eight lines. If not, then open Vim and
join the DNA sequence lines and the Quality Score lines.
From the dna.fstq Quality Control File, find the Linux commands to display the number of A
nucleotide. Hint: Use redirection.
Note: After each operation, run the cat command to display the contents of the generated file.
1. Use dna.fstq data file to generate the dna1 file after deleting the Identifier line; i.e. line starting
with the @ symbol
2. Use dna1 data file to generate dna2 after deleting the Quality line; i.e. the line below the Plus
line. Then, run the cat dna2 to verify the result of the operation.
3. Use dna2 data file to generate dna3 after deleting the Plus line. Then, run the cat dna3 to
verify the result of the operation.
4. Use dna3 data file to generate dna4 after joining all lines.
5. Use dna4 data file to generate dna5 after deleting all characters except the 'A' character
7. Optional: You can delete the generated file. rm dna1 dna2 dna3 dna4 dna5 (list the files
you want to delete, separated by spaces.)
Page 5 of 5
CMPS 101 / Lab Section / Fall 2024 / © Amelle Bedair