1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Dahasolnce [82]
3 years ago
12

Write commands to carry out the following commands: a) Print all lines containing the string John. b) Print all lines where a wo

rd starts with J. c) Print all lines ending with word stopped. d) Print all lines that don't contain was. e) Print lines where a word begins with K or k. 2. Write a bash script that copies all files of the current directory into a new sub-directory, and then deletes the created sub-directory along with its contents and displays a message that indicates completion of the task. 3. Write a bash script that reads two numbers x and y and performs addition, subtraction, multiplication, and division of the two numbers (x y, x-y, x*y, x/y) and prints out each of these values along with some text to indicate what these numbers are.
Computers and Technology
1 answer:
egoroff_w [7]3 years ago
3 0

Answer:

see explaination

Explanation:

1.

1. grep 'John' FileName

2. grep '^\J' FileName

3. grep 'stopped$' FileName

4. grep -v -e 'was' FileName

5. grep -E '^(k|K)' FileName

2.

#print the message to create subdirectory

echo "Creating a subdirectory to copy current directory files into named 'sub'"

#create subdirectory

mkdir sub

echo "Directory successfully created"

#Copy the files in the current working directory to created subdirectory

echo "Copying files of current directory into newly created subdirectory"

rsync -a --exclude='sub' * sub

#display the message to copy the files

echo "Copying operation completed successfully"

echo "Now deleting the created subdirectory along with its contents"

rm -rf sub

#indicated the message completion of task

echo "Operation completed successfully."

3.

#prompt and read the first number

echo "Enter the first number: "

read x

echo "Enter the second number: "

read y

#Compute arithmetic operations and store in the

#respective variable

addition=$(($x + $y))

subtraction=$(($x - $y))

multiplication=$(($x * $y))

division=$(($x / $y))

#print the values

echo "Addition of $x and $y is $addition"

echo "Subtraction of $x and $y is $subtraction"

echo "Multiplication of $x and $y is $multiplication"

echo "Division of $x and $y is $division"

You might be interested in
To copy cell contents, you can select the cell and then press the ____ keys.
LenaWriter [7]
To copy cell contents, you can select the cell and then press the CTRL + C keys. 
They act as a sort of a shortcut, so you don't have to select, right click and then choose copy. 
8 0
4 years ago
Question 8 OT TU
Semenov [28]
The qualities that are generally required are A. Vision
4 0
3 years ago
Within a email address Wat is the Domain
GenaCL600 [577]
The domain name<span> part of an email address has to conform to strict guidelines: it must match the requirements for a </span>hostname<span>, consisting of letters, digits, hyphens and dots. </span>
6 0
4 years ago
Read 2 more answers
What is the CPU Unit of a computer?
denis-greek [22]

Answer:

The computer's central processing unit (CPU) is the portion of a computer that retrieves and executes instructions. The CPU is essentially the brain of a CAD system. It consists of an arithmetic and logic unit (ALU), a control unit, and various registers.

Explanation:

.

4 0
3 years ago
Read 2 more answers
What term describes one or more characters following the last period in a filename, such as .exe, .txt, or .avi?
elixir [45]

Answer:

Explanation:

.exe: is a file extension, means file that contain executable program which can be run by Microsoft windows.

.txt: is also file extension which contains text (characters).

.avi: means (audio video interleave) is a file extension, which contains audio and video data encoded.

3 0
3 years ago
Other questions:
  • Which of the following technologies uses the results of a scientific discovery?
    10·2 answers
  • What are the functions of online gaming communities?
    12·1 answer
  • Which element appears within the top margin of the document but does not form the part of the body of the text?
    15·1 answer
  • What is information processing cycle​
    12·1 answer
  • Join my among us code<br> SHUHZF
    6·2 answers
  • U $ er Ideas for R 0 B 1 0 X?
    12·2 answers
  • A photojournalist is more employable than a reporter or a photographer because they can perform more than one job
    13·1 answer
  • What is the difference between packaged and tailored software ​
    13·1 answer
  • Please help me i’ll give you brainlist
    13·1 answer
  • _______ refers to the use of gps or rfid technology to create virtual boundaries that enable software to trigger a response when
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!