uli101_week11_practice
.docx
keyboard_arrow_up
School
Seneca College *
*We aren’t endorsed by this school
Course
101
Subject
Computer Science
Date
Dec 6, 2023
Type
docx
Pages
5
Uploaded by ChancellorDragonfly3067
ULI101 Linux Command Practice 11 (Using the sed and awk Utilities)
_____________________________________________________________________________
Instructions:
Write the answer to each question below the question in the space provided.
You can “wrap-around” the answer on separate lines if you need more space.
Part A: Display Results from Using the sed Utility
Note the contents from the following tab-delimited file called
~murray.saul/uli101/stuff.txt:
(this file pathname exists for checking your work)
Line one.
This is the second line.
This is the third.
This is line four.
Five.
Line six follows
Followed by 7
Now line 8
and line nine
Finally, line 10
Write the results of each of the following Linux commands for the above-mentioned file.
1.
sed -n '3,6 p' ~murray.saul/uli101/stuff.txt
print line 3 to line 6
2.
sed '4 q' ~murray.saul/uli101/stuff.txt
print the first 4 lines and then quit
3.
sed '/the/ d' ~murray.saul/uli101/stuff.txt
delete line that have the word the
1
PAGE
ULI101 Linux Command Practice 11 (Using the sed and awk Utilities)
_____________________________________________________________________________
4.
sed 's/line/NUMBER/g' ~murray.saul/uli101/stuff.txt
substitute line with NUMBER
Part B: Writing Linux Commands Using the sed Utility
Write a single Linux command to perform the specified tasks for each of the following questions.
1.
Write a Linux sed command to display only lines 5 to 9 for the file: ~murray.saul/uli101/stuff.txt
sed -n ‘5,9 p’ ~ murray.saul/uli101/stuff.txt
2.
Write a Linux sed command to display only lines the begin the pattern “and” for the file:
~murray.saul/uli101/stuff.txt
sed -n
‘/^and/p’ ~murray.saul/uli101/stuff.txt
3.
Write a Linux sed command to display only lines that end with a digit for the file:
~murray.saul/uli101/stuff.txt
sed -n
‘/[0-9]$/p’ ~murray.saul/uli101/stuff.txt
4.
Write a Linux sed command to save lines that match the pattern “line” (upper or lowercase) for
the file: ~murray.saul/uli101/stuff.txt and save results (overwriting previous contents) to:
~/results.txt
sed -n ‘/[L]line/’
~murray.saul/uli101/stuff.txt > ~/results.txt
2
PAGE
ULI101 Linux Command Practice 11 (Using the sed and awk Utilities)
_____________________________________________________________________________
Part C: Writing Linux Commands Using the awk Utility
Note the contents from the following tab-delimited file called
~murray.saul/uli101/stuff.txt:
(this file pathname exists for checking your work)
Line one.
This is the second line.
This is the third.
This is line four.
Five.
Line six follows
Followed by 7
Now line 8
and line nine
Finally, line 10
Write the results of each of the following Linux commands for the above-mentioned file.
5.
awk ‘NR == 3 {print}’ ~murray.saul/uli101/stuff.txt
print the 3
rd
line
6.
awk ‘NR >= 2 && NR <= 5 {print}’ ~murray.saul/uli101/stuff.txt
print the line 2
nd
to line 5
th
7.
awk ‘$1 ~ /This/ {print $2}’ ~murray.saul/uli101/stuff.txt
field 1 => This => print field 2
8.
awk ‘$1 ~ /This/ {print $3,$2}’ ~murray.saul/uli101/stuff.txt
3
PAGE
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
NASM programX86should run successfully in nasm in Linux platform while using the below commands for your clarity...
nasm -f elf question.asmld -melf_i386 question.o -o answer./answer
here question is code file name and answer is what we are giving for output file.
please answer as what I asked .... please don't waste my questions posting wrong answers and irrelevant languages
arrow_forward
The original Linux developers built a non-preemptible kernel for unknown reasons.In a setup with just one CPU, what good does a non-preemptible kernel do? However, with a system with several processors, why does this benefit decrease?
arrow_forward
The Virtual Memory Areas in Linux are what they sound like.
arrow_forward
In what ways does Linux handle memory swapping?
arrow_forward
What are cron jobs and how are they scheduled in Linux?
arrow_forward
What role does the swap space play in Linux memory management?
arrow_forward
When creating Linux, why did its creators choose with a kernel that doesn't allow for preemptive multitasking?If there is just one processor in use, why would you want to use a non-preemptible kernel? If utilizing a system with several processors is so beneficial, then why does it decrease in value?
arrow_forward
What differentiates a Linux clone from UNIX processes and threads is that it does not have a kernel.
arrow_forward
A number of concurrent methods included in Linux are unique to Linux and cannot be found in other operating systems.
arrow_forward
How does Linux handle memory swapping?
arrow_forward
When designing Linux, why did the original developers choose for a non-preemptible kernel?Which benefits does a non-preemptible kernel provide in a single-processor system? But why is the advantage diminished in a multi-processor system?
arrow_forward
How does Linux handle the administration of its virtual memory space?
arrow_forward
in linux enviroment
arrow_forward
What difference does it make if Linux partitions are utilized?
arrow_forward
When creating Linux, why did its creators choose with a kernel that doesn't allow for
preemptive multitasking?
In a single-processor system, why would you want to use a non-preemptible kernel? But
why does employing a system with several processors reduce the value?
arrow_forward
Shell script 2: (Display.sh)
Display Script (Display.sh) will display important information as shown below:
***********
qustudent is currently logged in the linux system
The Current date and time on the linux system is Mon Feb 13 06:29:57 PM +03 2023
system boot 2023-02-11 12:40
The current working path is /home/qustudent/Desktop/Sp2023/Project1
The current shell is /bin/bash
My Home Directory is /home/qustudent with # of files and Directories in my home = 70
Describe here briefly the purpose of the Script
arrow_forward
What is the significance of the swap partition in a Linux system?
arrow_forward
Many of Linux's concurrent methods are unique among OSes and cannot be found anywhere else.
arrow_forward
How can Linux access disk blocks without a FAT file system?
arrow_forward
When compared to other operating systems, Linux's collection of concurrent methods is, well, concurrent.
arrow_forward
Computer Science
in linux
An important concept in computer security is the principle of least privilege. Each user must be able to access only the information and resources that are necessary for legitimate purposes and activities. With the “principle of least privilege” in mind, how would you configure your Unix/Linux system to designate a small set of users as printer admins? For example, users steve and bob will need to perform printer administration tasks.
This includes running the lpadmin, cupsaccept, cupsreject, cupsenable, cupsdisable, cancel and lprm commands as root.
How will you configure the system to allow these printer admins to do their jobs without having any other kind of root user access?
Provide the relevant config file entries. (Absolute pathnames required for commands)
arrow_forward
What use does partitioning in Linux serve?
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L
CompTIA Linux+ Guide to Linux Certification (Mind...
Computer Science
ISBN:9781305107168
Author:Jason Eckert
Publisher:Cengage Learning
Related Questions
- NASM programX86should run successfully in nasm in Linux platform while using the below commands for your clarity... nasm -f elf question.asmld -melf_i386 question.o -o answer./answer here question is code file name and answer is what we are giving for output file. please answer as what I asked .... please don't waste my questions posting wrong answers and irrelevant languagesarrow_forwardThe original Linux developers built a non-preemptible kernel for unknown reasons.In a setup with just one CPU, what good does a non-preemptible kernel do? However, with a system with several processors, why does this benefit decrease?arrow_forwardThe Virtual Memory Areas in Linux are what they sound like.arrow_forward
- When creating Linux, why did its creators choose with a kernel that doesn't allow for preemptive multitasking?If there is just one processor in use, why would you want to use a non-preemptible kernel? If utilizing a system with several processors is so beneficial, then why does it decrease in value?arrow_forwardWhat differentiates a Linux clone from UNIX processes and threads is that it does not have a kernel.arrow_forwardA number of concurrent methods included in Linux are unique to Linux and cannot be found in other operating systems.arrow_forward
- How does Linux handle memory swapping?arrow_forwardWhen designing Linux, why did the original developers choose for a non-preemptible kernel?Which benefits does a non-preemptible kernel provide in a single-processor system? But why is the advantage diminished in a multi-processor system?arrow_forwardHow does Linux handle the administration of its virtual memory space?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.Computer ScienceISBN:9781337569798Author:ECKERTPublisher:CENGAGE LCompTIA Linux+ Guide to Linux Certification (Mind...Computer ScienceISBN:9781305107168Author:Jason EckertPublisher:Cengage Learning
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L
CompTIA Linux+ Guide to Linux Certification (Mind...
Computer Science
ISBN:9781305107168
Author:Jason Eckert
Publisher:Cengage Learning