Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1: regexp 1. Write a regexp pattern to search for any Vermont phone numbers. You know the area code and it might or might

Task 1: regexp

1. Write a regexp pattern to search for any Vermont phone numbers. You know the area code and it might or might not be in parentheses. The exchange is separated by spaces or dashes (or some other non-chars you like) or it might not be. There may be no spaces! Demonstrate it with my QC (quality control) dataset. Get the lab06.802 text file from the class web server (http://lab.cis.vtc.edu/files/lab06.802) or Moodle. It has multiple lines of texts where some have VT phone numbers and some don't. Some have parens and some don't, etc. Pipe that file through your regex pattern and pull out the valid lines only. What regex 'version' did you use?

2. Let's answer these questions using the files from the lab05 tar file. These can be answered with a regexp pattern using grep or egrep. You may pipe the result from the pattern into another grep or wc if required. A. Using w.txt, how many terminals have been using "sas82" for 6 to 9 days?

B. We had 2 harddrives crash on a large server. Keeping saslog.log.gz compressed on the disk, how many jobs are using "/SAS/C" or /SAS/H" as their "-work" dir on the server sassrv1.btv.ibm.com (1st col)?

Note: Each line in saslog.log is a job. This log includes 4 servers and many (10+) harddrives per server. Therefore, we only want the 'small subset' of 2 drives from only 1 server.

Extra: What if I really wanted the list of unique users (not jobs). If you are up the challenge, write the (piped) command to get the number of unique users from that subset above. Hint, the answer is 25!

C. Using psef.txt, how many processes are running a dtterm or aixterm "terminal"? D. We have a suspect time of when a temp drive started to get full. Using who.txt, which processes were started on August 31 between 8am and noon? (Note: You can use 11:59 as the ending time if that's easier. This is regexp pattern matching after all...)

A. We have a suspect time of when a temp drive started to get full. Using who.txt, which processes were started on August 31 between 8am and noon? (Note: You can use 11:59 as the ending time if that's easier. This is regexp pattern matching after all...)

Task 2: sed You need to restart some of these jobs for users from the harddisk crash above. (You might have to do a lot of these, so you plan to use a script.) To begin, take your command from 2B above and grep for user "jphillip". He should have 2 processes fitting the criteria. Add a 'sed' command to change that work directory to /SAS/W. Just print to stdout but you can imagine that we can xargs and actually run the new command.

Task 3: awk Each of the tasks below are very similar to the task in 2. above, but with some new requirement which can be done with awk. A. List the users, CPU time and process (1st, 6th, and last cols) from w.txt, which have a process taking more than 100 min of CPU time according to the 6th column = PCPU. (string regex)

B. Now we want to find unhealthy processes. Take the result of Task 1C (users of dtterm or aixterm) and use awk to list the processes where the parent pid (col #3) is equal to 1. A parent pid of 1 means that 'root' now owns it, and it is probably 'orphaned' and needs to be killed. (Hint, I found 45 of them.)

C. Keeping saslog.log.gz compressed on the disk, we want to find the CPU-hogs. Count the users with a CPU-utilization over 105 (numeric) and a CPU-time of over 500 min (regex) on the server sassrv.btv.ibm.com (1st col). (500 min is over 8 hours.) Only print these cols: userid (3rd col), pid (4th col), CPU-utlization (6th col), CPU-time (9th col) and command (10th col). How many jobs are there which are these CPU-hogs? (Here's the answer: 65) Then sort by CPU-time col use my cool newly discovered -k sort option! Show me worst handful of offenders (or maybe they are simply the super-users and doing all the work!). See a pattern?!

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions