Question

Linux: Regular Expressions file name is studentsyslog.txt Use a regular expression and grep or egrep to...

Linux: Regular Expressions

file name is studentsyslog.txt

Use a regular expression and grep or egrep to filter the file so the output displays only the items requested. Put your full command in the space provided.

  1. Display only the lines which contain the word CUPS


Homework Answers

Answer #1
  • As per given, File name is studentsyslog.txt
  • In Linus, Regular expression is nothing but a string that can be used to retrive perticular sequence of output.
  • grep is one of Regular expression commands.

As per requirement we need to filer the file so that output displays only the lines which contain the word CUPS in given file.

Here is there is no position of word mentioned like Sarting with , ending with..

Let us assume our present working directory is same as file exists. So the command is :

grep 'CUPS'  studentsyslog.txt

If PWD is not as directory which file exists,

grep 'CUPS' /path/studentsyslog.txt

Know the answer?
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
Similar Questions
linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions 1.Match only the lines that contain an employee ID (and nothing else) with the format 12345.
linux regular expression file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
linux regular expression file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Write a SED command that could replace all of the area codes that use parenthesis so that they are removed and replaced with a single dash like the others. Example: (222) 222-2222 should become 222-222-2222.
linux Regular expressions file name: lab3test.txt Employee ID Full Name Phone Age =========== ========= ===== ===...
linux Regular expressions file name: lab3test.txt Employee ID Full Name Phone Age =========== ========= ===== === 12564 Carol, Tara (222) 555-1231 44 45321 45612 Knotts, Don 78 29878 Evans, Bob (222) 341-4311 32122 Smith, 29 41221 Id, Bill 222-231-2322 33 41231 23121 Lemon, Jay 222-321-43 23341 Aaron, John 222-555-7321 34 12564 Carol, Tara (222) 555-1231 44 45321 Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Display all lines where the...
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
Write regular expressions that will match IP addresses and usernames in a Microsoft IIS log file....
Write regular expressions that will match IP addresses and usernames in a Microsoft IIS log file. First, you will write a regular expression that matches IP addresses within the re.compile function call on line 36. Next, you will write a regular expression that matches usernames (in the format domain\username) on line 50. Finally, in steps 3 and 4 you will write a loop for each step that displays all the IP addresses (gathered into the list ipAddresses) and usernames (gathered...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word " STREET" to the address, for all who live on 2nd or 3rd. For example: "2nd" becomes "2nd STREET" and "3rd" becomes "3rd STREET". Display only the first 9 lines. Hint: Use 2 sed statements with pipes. Task C Display all lines in famous.dat that end in 0 or 1, and have a 1 in the 3rd from the last column. For example lines...
linux Using dpkg or apt, what would be the full command you would use to find...
linux Using dpkg or apt, what would be the full command you would use to find out if the python package was installed? This is tricky because Python’s actual package name is python3. $ If it is installed, what version is installed according to the dpkg or apt output? If it wasn’t installed, can you install it? What command would you use to do this? $ 2. Using dpkg, what would be the full command you would use to determine...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items separated by a space. Read the list. Use a for loop to write (use echo) the items to a file called shopping_list. You should use >> to append the output to the file, so each time the script is run the list should get longer. After the for loop finishes, display (use cat) the contents of the shopping list with 1 item per line....
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and the output in a word document and submit it. Part1: 1. Log in to Linux using your user account name and password. 2. If you logged in using a graphical login screen, open a terminal window by clicking on the icon in the lower left corner of the desktop to open the main menu, then selecting System Tools, then Terminal. A terminal window opens....
Lab of operating system: please use the linux server please so all the commands used and...
Lab of operating system: please use the linux server please so all the commands used and the output PROBLEM 1: Create a file and name it f1 • Cerate a directory and name it d1 • Move f1 to d1 • Create a directory and name it d2 • Move d1 to d2 • Check if d1 is inside d2 • Check if f1 is inside d1 • While your (Current Working Directory) CWD is d1, move back f1 to...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT