Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. [12 marks This question asks you to use regular expressions For each of the following questions, develop a single command line to perform the

image text in transcribed

2. [12 marks This question asks you to use regular expressions For each of the following questions, develop a single command line to perform the task required, and use script to record your most successful execution of the command line in a file. Your command lines must work no matter what the current working directory is The names of the files to be generated by script, for the four questions below, are a2q2 a.txt, a2q2_b.txt, a2q2_c.txt and a2q2_d.txt You are only allowed to use the following UNIX commands: grep, ls, cat and wc. You will lose half the marks if you use a command not in this list. Your solutions need not make use of all these commands. The first three questions below ask you to search for English words in a dictionary file. Each line of this file contains an English word. This dictionary file can be found at /usr/share/dict/linux.words on bluenose (a) Print all the words in this dictionary file that start with un and end with ix. This includes the word unix itself. (b) Find all the words in this dictionary file that contain all four lower-case characters that appear in the word "unix" (ie, 'u, n, T, and X) in alphabetical order For example, influx is such a word, but unfix is not (c) Print a single integer that is the number of 6-character words in this dictionary file that start with can and end with either a or c. For example, canada is such a word, but canzona, cancel and camera are not (d) List all the files in /usr/bin whose filenames contain lowercase English alphabet characters only and also contain the word file as a (contiguous) substring. For example, file and nsrfile are such files, but grub2-file is not

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 Databases questions

Question

Technology. Refer to Case

Answered: 1 week ago