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
Compare the two types of formatting that IDE devices must go through. What is the primary difference between the two?
Andrei [34K]
A quick format<span> changes the file system while the </span>full format<span> also checks the </span>drive for bad sectors.  <span>The scan for bad sectors is the reason why the Full </span>format<span> takes twice as long as the </span>Quick format<span>. If you choose the </span>Quick format<span> option, the </span>format<span> removes address files from the partition, but does not scan the disk for bad sectors.</span>
7 0
3 years ago
Read 2 more answers
What is the best approach to integrating domain-specific needs? Why is this approach better than others?
Makovka662 [10]

Answer:

Integrating domain information system increase the level of the organization and its efficiency in the specific domain. This approach is better than others because it first planned the system in systematic order and then it is implemented by proper testing so that the system does not fails and it give efficient result.

It is the low cost approach which can be easily used by the various companies and give faster and profitable results.  This integrating approach must be domain specific and describe different level of abstraction.

7 0
3 years ago
Online
Tanya [424]

Answer:

i can't understand what u want to say

5 0
3 years ago
Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a con
Sophie [7]

Answer:

Explanation:

The following code is written in Java. It creates the three classes as requested with the correct constructors, and getter/setter methods. Then the test class asks the user for all the information and creates the customer object, finally printing out that information from the object getter methods.

import java.util.Scanner;

class Person {

   String name, address, telephone;

   private void Person (String name, String address, String telephone) {

       this.name = name;

       this.address = address;

       this.telephone = telephone;

   }

   public String getName() {

       return name;

   }

   public void setName(String name) {

       this.name = name;

   }

   public String getAddress() {

       return address;

   }

   public void setAddress(String address) {

       this.address = address;

   }

   public String getTelephone() {

       return telephone;

   }

   public void setTelephone(String telephone) {

       this.telephone = telephone;

   }

}

class Customer extends Person {

   String customerNumber;

   Boolean mailingList;

   public Customer(String s, Boolean mail) {

       super();

       this.customerNumber = customerNumber;

       this.mailingList = mailingList;

   }

   public String getCustomerNumber() {

       return customerNumber;

   }

   public void setCustomerNumber(String customerNumber) {

       this.customerNumber = customerNumber;

   }

   public Boolean getMailingList() {

       return mailingList;

   }

   public void setMailingList(Boolean mailingList) {

       this.mailingList = mailingList;

   }

}

class Test {

   public static void main(final String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Customer Name: ");

       String name = in.nextLine();

       System.out.println("Enter Customer Address: ");

       String address = in.nextLine();

       System.out.println("Enter Customer Telephone: ");

       String telephone = in.nextLine();

       System.out.println("Would you like to receive mail? y/n ");

       Boolean mail;

       if(in.nextLine() == "y") {

           mail = true;

       } else {

           mail = false;

       }

       Customer customer = new Customer("1", mail);

       customer.setName(name);

       customer.setAddress(address);

       customer.setTelephone(telephone);

       System.out.println("Name: " + customer.getName());

       System.out.println("Address: " + customer.getAddress());

       System.out.println("Telephone: " + customer.getTelephone());

       System.out.println("Wants to receive mail: " + String.valueOf(customer.getMailingList()));

   }

}

7 0
3 years ago
Find prime no using Java
bonufazy [111]

Answer:

Um

Explanation:

I don't understand

4 0
3 years ago
Other questions:
  • What number is needed to complete the pattern 66, 73, 13, 21, 52,_, 10, 20?
    12·1 answer
  • Jacob is a teacher and wants to sort his grades based on Test 1 and then on Test 2.
    14·2 answers
  • How can I become front end developer
    15·2 answers
  • How many ways can you add an image into google slides?
    8·1 answer
  • How do I copy and paste equations and pictures like math graphs, to post on this site to help get my questions answered?
    13·2 answers
  • If you're using the paintbrush tool and want to change the color of the paint being used what should you change
    6·1 answer
  • Write a program in c++ to displaypascal’s triangle?
    14·1 answer
  • What is variable declaration in java ​
    6·2 answers
  • Help plsssssssss i have no friends
    5·2 answers
  • ________is one of the most popular payment gateways founded in in December 1998​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!