Question

Write a single shell script which uses grep to get the following information from judgeHSPC05.txt: How...

Write a single shell script which uses grep to get the following information from judgeHSPC05.txt:

How many lines start with a capital letter or a period (.)?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Files D e main.sh judgeHSPC05.txt judgeHSPC05.txt saved 1 A line start capital 2 this is not 3 this shoule also count 4 no ne: Files main.sh judgeHSPC05.txt GNU bash, version 4.4.12(1)-release > bash main.sh main.sh saved 1 1 2 #cat commmand used to

code:

#cat commmand used to read the file contents

# | pipe operator pass the file contents to grep command

#[A-Z] matches only capital letters , ^ tells it should be starting

#\| or operator

#\. to match dot operator

# | wc -l , line count, which given how many such lines

cat judgeHSPC05.txt | grep "^[A-Z]\|\." | wc -l

Add a comment
Know the answer?
Add Answer to:
Write a single shell script which uses grep to get the following information from judgeHSPC05.txt: How...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Task 2: Writing some regex patterns 1. Create script named "regexes.sh" and write grep -r statements...

    Task 2: Writing some regex patterns 1. Create script named "regexes.sh" and write grep -r statements to search your work for the following patterns: • All sed statements • All lines that starts with the letter m All lines that contain three digit numbers • All lines that start with a vowel • All lines that contain loops All echo statements with at least three words Hint: You can use grep with -e to use the ERE regex features

  • I need this done ASAP. Please write a bash shell script that does the following: Prints...

    I need this done ASAP. Please write a bash shell script that does the following: Prints out how many users are logged on. This can be accomplished using who and wc. Prints out a list of currently logged on users. This can be accomplished using who, grep, regular expressions, and echo. Prints out how many processes you have running from past days, and a list of those jobs. Use `whoami` to get your username. Run ps -ef and see how...

  • Write a shell script called GetMyStuff.sh that will provide the above information (the script must be...

    Write a shell script called GetMyStuff.sh that will provide the above information (the script must be a executable, and must work regardless of which directory it is in). Also, just saying cat MyStuff.txt is not sufficient. (1.0%) A pipeline is the combination of at least 2 commands, where the output of command1 is the input for command2. The syntax is command1 | command2 where | is the pipeline operator. Read the man pages about the ls and wc commands. Devise...

  • Unix code problem Write a shell script that does the following : Read many lines of...

    Unix code problem Write a shell script that does the following : Read many lines of text from the standard input device (keyboard) and copy them to the standard output. Precede each output line with a line number Explain all steps

  • USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file,...

    USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file, and print (user’s choice of printers) identical form letters to each recipient. Either E197, E-199, E-194 printers or to project2.output. Prompt the user for their choice. 2) The script and output file are due: per Moodle timeline. Please upload your fully functioning script (project2.sh) your data file (project2.input) and your output file (project2.output) into Moodle. 3) Requirements of the script. a. You can use...

  • Hello, I am attempting to write a basic shell script using bash. It will need to...

    Hello, I am attempting to write a basic shell script using bash. It will need to print the user, host, time, and date. It will need to take user input for a txt file to be searched and create a new file to save the results. It must print the number of lines and characters in the text. The user will need to enter three words to be searched, and the number of occurrences of those words in the text...

  • The first script is validate.sh. This is a simple form validation script that will be used...

    The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....

  • Task 1 Write a shell program that uses the following snippets to collect usage information on the ethernet interface; •U...

    Task 1 Write a shell program that uses the following snippets to collect usage information on the ethernet interface; •Use the output of the ifconfig command •Use the pipe symbol ‘|’ (usually Shift-\ above the Enter key) to send output text of one program to the input of the following program •Use grep to select the text for just the received and transmitted bytes on the network interface •Store the number of bytes in a shell variable Run the programs...

  • Write a C shell script called canrun that displays the names of the files in the...

    Write a C shell script called canrun that displays the names of the files in the current directory that have execute permission set (permission being for the file owner) and how many of these files there are. For example, output from the script might look like: Executable files: canrun menunix showperm 3 files found

  • You will create a shell script that prints out the following information about the system it is run on: • The system’s n...

    You will create a shell script that prints out the following information about the system it is run on: • The system’s name and IP address • How much memory the system is currently using, and how much total memory it has • The number of CPUs of the machine • The number of unique users on the system at that moment When your script is run, each of these values should be clearly labeled in the output, such as...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT