Question

In: Computer Science

Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the...

Unix / Linux

16.

Regular Expression:

Given the following regular expression, provide a description of the intended match.

^[^A-Z]

17.

Regular Expression:

Given the following regular expression, provide a description of the intended match.

[^^!]

18.

Regular Expression:

Given the following regular expression, provide a description of the intended match.

^.\{72\}$

19.

Regular Expression:

Given the following regular expression, provide a description of the intended match.

[A-Za-z0-9]

20.

Regular Expression:

Given the following regular expression, provide a description of the intended match. [There's a single space character inside the first square bracket pair.]

[ ][A-Za-z]\{1,\}$

Solutions

Expert Solution

16. [^ ] means a single character that isn't a part of this group.

Hence, [^ A-Z] means no capital letters should be present.

^[] means this pattern should be included in the beginning of the line.

Hence, ^[^A-Z] means no capital letter should be present in the beginning of the line.

17. [^] means anything except the characters or symbols enclosed.

hence, [^^!] means any character other than ^ or ! is acceptable.

18. ^.\{72\}$ means to group all the lines which are exactly 72 characters wide.

19. [ ] means a single character present within the group.

hence, [A-Za-z0-9] means any character or numeric value is acceptable as a single character.

20. It means if you want to replace these relating character to something else.

It can be manipulated in sed command as

$ sed 's/[][A-za-z]\{1,\}$/replace/'

The alphabets should be replaced by the specified characters. Any combination of a space with an alphabet should be replaced with the specified digits.


Related Solutions

Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed...
Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed description indicating all the Input/Output (I/O) connections. Every stdin, stdout, and stderr for each command will need to connect to something. grep a < words | wc -l > a_count.txt 22. Explain what is wrong (if anything) with the following command pipeline. cd | ls 23. Stream Editor: Write a sed command to delete digits, but only on lines that end with a period....
linux: Regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: Regular expressions file name: 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.Show only the lines that end with an ellipses (3 dots) :
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: regular expressions file name: 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 that were written to the file between the times of 12:55 and 12:59 (inclusive). This is tricky. Don’t think of these times as numbers, think of these times as a series of characters (a 1 followed-by a 2 followed-by a colon,...
linux: regular expressions file name: studentsyslog.txt Use a regular expression and grep or egrep to filter...
linux: regular expressions file name: 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 that were written to the file between the times of 12:55 and 12:59 (inclusive). This is tricky. Don’t think of these times as numbers, think of these times as a series of characters (a 1 followed-by a 2 followed-by a colon,...
What are control structures in Linux/Unix?
What are control structures in Linux/Unix?
Unix / Linux 31. Given the first two commands, what is the expected output for the...
Unix / Linux 31. Given the first two commands, what is the expected output for the third command? (single quotes) $ echo * a b c $ x=* $ echo '$x' 32. Given the first two commands, what is the expected output for the third command? (Single quotes inside of double quotes) $ echo * a b c $ x=* $ echo "'$x'" 33. Given the first two commands, what is the expected output for the third command? (double quotes...
linux Using the grep or egrep commands, what would be the full command (including regular expression)...
linux Using the grep or egrep commands, what would be the full command (including regular expression) to view only the lines in the file /boot/grub/grub.cfg that DO NOT begin with a hashtag (the # sign). In other words, what would be the command to print all the lines in this file that do not begin with this character.
Consider the following regular expression meta operators: ( ) [ ] { } . * +...
Consider the following regular expression meta operators: ( ) [ ] { } . * + ? ^ $ | \ For each of the following, give one example of strings which the regular expression would match. Describe (colloquially, in a manner that a non-technical person would understand) the set of strings that the pattern is designed to match. Each regular expression is enclosed in the pair of '/' characters below. [2 marks each] (a) /^[a-z][0-9]*\.$/ (b) /([0-9]+)\s\w+\s\1/
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of...
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of mv command The mv command is more than just a wrapper around the rename system call. Write a version of mv that accepts two argument. The first argument must be the name of a file, and the second argument may be the name of a file or the name of a directory. If the destination is the name of a directory, then mv moves...
1. What is a regular expression? Write a regular expression that will detect “College” and “collegE”....
1. What is a regular expression? Write a regular expression that will detect “College” and “collegE”. 2. What is degree centrality? Create a graph of 4 vertices and compute the degree centrality of the vertices. 3. Compute internal and external community densities for a graph containing 6 nodes. You can create any graph of 6 nodes with at least 4 edges.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT