Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Unix - 15 points . Type the commands to: Make two directories called bonus1 and bonus2 Change to bonus1 directory Print the current directory Using

Unix - 15 points. Type the commands to:

  • Make two directories called bonus1 and bonus2
  • Change to bonus1 directory
  • Print the current directory
  • Using cat create a file called dates.txt that contains the lines

Saturday Dec 30

Sunday Dec 31

Monday Jan 1

Tuesday Jan 2

Wednesday Jan 3

  • List the contents of the bonus1 and bonus2 directories, showing the file permissions
  • Count how many file names end in ".txt" in the bonus1 directory
  • Copy dates.txt to directory bonus2
  • Change to the bonus2 directory
  • Count how many files names in bonus2 contain the pattern

character e character .txt

  • Count the number of lines in dates.txt
  • Print the lines and line numbers in dates.txt containing Jan
  • Print how many lines in dates.txt contain Dec
  • Print the lines in dates.txt that don't contain Dec, and write the output in January.txt
  • Sort dates.txt based on the third column, and write the output in sorted.txt
  • Print the first 3 lines of dates.txt. In another command, print the last 2 lines of heads.txt

SED & AWK - 6 points. Type the sed and/or awk commands needed to:

  • Create a new file called months.txt that contains only the month and the day name of dates.txt
  • Find the lines containing Jan in dates.txt, and print only the names of the days (using awk only)
  • Find the lines containing Jan in dates.txt, and print the names of the days (using awk and grep)
  • Print the 3rd column of dates.txt and sort it numerically
  • In a single-line command delete the second line of dates.txt, then print the third line of the resulting file.
  • Replace Dec by December in dates.txt, and write the output to a new file called longnames.txt

Python - 9 points. Type the Python to:

  • Define a variable called sentence containing

Today is Friday July 30th, tomorrow is Saturday July 31st.

  • Replace July by August, and define the output as a new variable called new_sentence
  • Count the number of characters (including spaces) in sentence
  • Capitalize all letters in sentence
  • Count how many times July appears in sentence
  • Create a list called days containing

Mon Tue Wed Thu Fri Sat Sun

  • Print the second element of the list days
  • Using the command range, create a list numbers containing the numbers 1 to 9. Create another list odd containing only the single-digit odd numbers
  • Create a loop that uses the list days to print the abbreviated name of the days of the week

Today is [name of the day]

Bonus (2 pts). Using a loop and the list odd, print the even numbers 2-10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions