CODE
[1] grep '^[A-Z]' /usr/share/common-licenses/GPL-3
[2] grep -Po '(?<=\().*?(?=\))'
/usr/share/common-licenses/GPL-3
[3] grep '^[A-Z].*\.$' /usr/share/common-licenses/GPL-3
[4] grep 'GPL\|General\sPublic\sLicense'
/usr/share/common-licenses/GPL-3
OUTPUT
1.
2.
3.
4.
EXPLANATION
The grep scans a document for a specific pattern of characters,
and shows all lines that contain that pattern. The pattern that is
looked/searched in the file is called regular
expression.
Syntax - grep [options] pattern [files]
[1] grep '^[A-Z]'
/usr/share/common-licenses/GPL-3
The ^ regular expression pattern indicates the beginning of a line.
This can be utilized in grep to match the lines which start with
the given string or example. In our case we want to get the lines
that will start with uppercase letter only. So we used
^[A-Z].
[2] grep -Po '(?<=\().*?(?=\))'
/usr/share/common-licenses/GPL-3
-P option Interpret PATTERN as a Perl regular expression and -o :
Print only the matched parts of a matching line
(?<=\().*?(?=\))
This will look for the opening bracket ( and then
ignores it, then prints all the non-close-parenthesis characters
that follow.
[3] grep '^[A-Z].*\.$'
/usr/share/common-licenses/GPL-3
We can combine( perform and operation) two regular expression by
using .*
^[A-Z] this will return words start with capital
letters
\.$ this will return words end with
. (Period)
[4] grep 'GPL\|General\sPublic\sLicense'
/usr/share/common-licenses/GPL-3
For or we used \| or operator in
regular expression. for space, we used \s regular
expression.
Using Linux commands grep 3.0.3 Questions: Using patterns wtih grep Provide the grep commands for the...
These are linux commands. Type cd /usr/share/dict. The file words is the Linux English dictionary. You will use egrep to explore this file. Your answers below will be the egrep command that solves the problem. a.List all words that have the letter a followed immediately by the letter z. b.List all words that have the letter a followed sometime later by the letter z (there must be at least one letter in between). c.List all words that start with the...
LINUX ubuntu please. Please show the result's screenshot. Thanks in advanced. Using the regular expression rules create grep commands that locate the following lines in /etc/services: All lines that contain the string smtp. All lines that begin with the string smtp. All lines that include periods (dots, .) All lines that include the string ftp except when that string is followed immediately by a dash (-). All lines in which the letter a follows the letter z. All lines that...
LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...
Unix/Linux The purpose of this lab is to practice the commands to manage and organize files and directories: How would one go about this? Thanks. Task 1: Preliminaries: 1) If you have not already done so, create a directory called bin under your HOME directory. 2) If you have not already made a copy (using ftp) of the file called famous.dat from the Assignment#1, do that now. 3) Make bin the active/working directory. Task 2: Perform all of the following...
Using linux Write one-line New Tab ands that determine and print the following desired output: 1. The total word count in files file1.txt, file2.txt, and file3.txt combined (assume the three files exist in the current directory) 2. How many user accounts are not allowed to log in to the system. You need to calculate the number of users in file /etc/passwd that include /nologin on their line. 3. The name of the 6 largest files in/usr/bin , while suppressing any...
USING Unix/Linux shell !!!: 1) Write a script (project2.sh) that will take information from a file, and print (user’s choice of printers) identical form letters to each recipient. Either E197, E-199, E-194 printers or to project2.output. Prompt the user for their choice. 2) The script and output file are due: per Moodle timeline. Please upload your fully functioning script (project2.sh) your data file (project2.input) and your output file (project2.output) into Moodle. 3) Requirements of the script. a. You can use...
Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a shell file called by (your name), your enrollment number, your program and the courses you study. Use the appropriate variables and display the above to the standard output (screen). . 2. Write A Shell Script to perform the following: Display the files and directories Print the date in 24 hour format Display the System id Display the current working directory Print the status of...
Creating a Shell Interface Using Java This project consists of modifying a Java program so that it serves as a shell interface that accepts user commands and then executes each command in a separate process external to the Java virtual machine. Overview A shell interface provides the user with a prompt, after which the user enters the next command. The example below illustrates the prompt jsh> and the user’s next command: cat Prog.java. This command displays the file Prog.java on...
The goal is to create a code for implementing a Columns game using pygame Your program will read its input via the Python shell (i.e., using the built-in input() function), printing no prompts to a user with no extraneous output other than precisely what is specified below. The intent here is not to write a user-friendly user interface; what you're actually doing is building a tool for testing your game mechanics, which we'll then be using to automatically test them....