39. To match all your .files (that is, any hidden files begins with a period). A
ID: 3886271 • Letter: 3
Question
39. To match all your .files (that is, any hidden files begins
with a period).
A. ls .*
B. ls *.*
C. ls [.*]
D. ls (.)*$
E. ls "."*
7
40. To list filenames where the
first two characters can be any
character, followed by an ‘R’, followed by any string:
A. ls **R*
B. ls *{2}R-
C. ls ^??R*
D. ls $??R*
E. ls ??R*
Consider the following problems (
#41-#50) with grep command. Th
e content of data.txt is:
48 Dec 3BC1997 CPPX 68.00 LVX2A 138
483 Sept 5AP1996 USP 65.00 LVX2C 189
47 Oct 3ZL1998 CPPX 43.00 KVM9D 512
219 dec 2CC1999 CAD 23.00 PLV2C 68
484 nov 7PL1996 CAD 49.00 PLV2C 234
483 may 5PA1998 USP 37.00 KVM9D 644
216 sept 3ZL1998 USP 86.00 KVM9E 234
41. What would be the result of the following grep command with
the data.txt file a
s provided above.
grep '48[34]' data.txt
A. 0
B. 1
C. 2
D. 3
E. 4
F. 5
42. What would be the result of the following grep command with
the data.txt file a
s provided above.
grep '[Ss]ept' data.txt
A. 0
B. 1
C. 2
D. 3
E. 4
F. 5
43. What would be the result of the following grep command with
the data.txt file a
s provided above.
grep '[Ss]ept' data.txt | grep 483
A. 0
B. 1
C. 2
D. 3
E. 4
F. 5
8
44. What would be the result of the following grep command with
the data.txt file a
s provided above.
grep 'K...D' data.txt
A. 0
B. 1
C. 2
D. 3
E. 4
F. 5
Explanation / Answer
39) Option A: (ls .*)
Explanation:
ls.* returns all the hidden files begins with a period. Here ls represents list the files and .(dot) represents files that starts with a period. And * represents all the files.
40)Option E: ls ??R*
Explanation:
We use ? symbol to match any single character. In this case,first two characters can be any
character, followed by an ‘R’,followed by any string.
41)Option D: 3
grep '48[34]' data.txt
would display three lines
483 Sept 5AP1996 USP 65.00 LVX2C 189
483 may 5PA1998 USP 37.00 KVM9D 644
484 nov 7PL1996 CAD 49.00 PLV2C 234
Explanation:
By placing a group of characters within brackets ("[" and "]"), we can specify that the character at that position can be any one character found within the bracket group.
42)Option C: 2
grep '[Ss]ept' data.txt
would display two lines
483 Sept 5AP1996 USP 65.00 LVX2C 189
216 sept 3ZL1998 USP 86.00 KVM9E 234
Explanation:
By placing a group of characters within brackets ("[" and "]"), we can specify that the character at that position can be any one character found within the bracket group.
44)Option C: 2
grep 'K...D' data.txt
This command would display two lines
47 Oct 3ZL1998 CPPX 43.00 KVM9D 512
483 may 5PA1998 USP 37.00 KVM9D 644
Explanation:
The period character (.) is used in regular expressions to mean that any single character can exist at the specified location.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.