Exercise 1 Before you start to write the next script, first run the 'who' command at the UNIX prompt and redirect it into a file named users.txt (Then, look at the file and study its format!) Afterward, write a program that reads in and uses the 'split' function to break up each line of the 'users.txt'file into three variables: who, where, and when_and_IP, and then reprints it to the screen in this format: who on where at when_and_IP. So, if your text input file contains three lines, I expect to see code that produce three lines of output, each of which will look like: bsd17 on ttyp0 at Aug09 08:07 (132.85.201.182). Exercise 2 Write a program that takes a sentence with two adjectives describing an animal and reverses the adjectives, using regular expressions, and then outputs the new sentence. The sentence that it must read in should be of the following format, where the two adjectives are separated by a comma and a space: The quick, brown fox jumped over some other non-descript animal. rint out any words that contain two vowels next to each other. The vowels do not have to be the same. You should create a test input file and make your script process it.
Get Free Quote!
422 Experts Online