-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab Number 4 Week 5
More file actions
158 lines (139 loc) · 2.59 KB
/
Lab Number 4 Week 5
File metadata and controls
158 lines (139 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
Number 1
[cs45aa15@mc-redhat01 ~]$ cp /tmp/week-5/* $HOME/homework/week-5
[cs45aa15@mc-redhat01 week-5]$ ls
mnm names_file regtxt regtxt2
months numbers regtxt1 tester1
Number 2
[cs45aa15@mc-redhat01 week-5]$ sort months
Apr
Aug
Dec
Feb
Jan
Jul
Jun
Mar
May
Nov
Oct
Sep
Number 3
[cs45aa15@mc-redhat01 week-5]$ touch monbrs
[cs45aa15@mc-redhat01 week-5]$ sort -m months numbers > monbrs
[cs45aa15@mc-redhat01 week-5]$ cat monbrs
10
20
30
40
50
60
70
80
90
100
1
5
15
25
35
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Number 4
[cs45aa15@mc-redhat01 week-5]$ egrep ^[r]{1} /etc/passwd
root:x:0:0:root:/root:/bin/bash
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
radvd:x:75:75:radvd user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
Number 5
[cs45aa15@mc-redhat01 week-5]$ egrep -c ^[r]{1} /etc/passwd
5
Number 6
[cs45aa15@mc-redhat01 week-5]$ egrep -v 'cs45' /etc/passwd > nocs45
[cs45aa15@mc-redhat01 week-5]$ grep -c 'cs45' nocs45
0
Number 7
[cs45aa15@mc-redhat01 week-5]$ egrep 'y' months
May
Number 8 -
[cs45aa15@mc-redhat01 week-5]$ egrep -c 'root|ly|body|ROOT|LY|BODY' rootlybody
6
[cs45aa15@mc-redhat01 week-5]$ cat rootlybody
root
ly
body
ROOT
LY
AARFFDDG
BODY
FDSF
fdfasfd
Number 9
[cs45aa15@mc-redhat01 week-5]$ cat -TE regtxt
I am line one$
2 I am$
100 is cost of ticket$
two spaces in begin$
two spaces at end $
$
line with 5 spaces above$
jan$
feb$
408-334-9808$
446-35-1088$
aa$
aaaaaAA$
a$
XaaaA $
55555566666$
55555555 $
55$
10.2.3.4$
101.20.5.6$
9.2.3.4$
192.16.2.244$
Number 10
[cs45aa15@mc-redhat01 week-5]$ egrep '[0-9]{3}-[0-9]{3}-[0-9]{4}' regtxt
408-334-9808
Number 11
[cs45aa15@mc-redhat01 week-5]$ grep '^a.*A$' regtxt
aaaaaAA
Number 12
[cs45aa15@mc-redhat01 week-5]$ egrep '[0-9]{3}-[0-9]{2}-[0-9]{4}' regtxt2 > ssn
[cs45aa15@mc-redhat01 week-5]$ sed -ie 's/[0-9]{4}/****/g' ssn
[cs45aa15@mc-redhat01 week-5]$ cat ssn
446-35-****
346-35-****
Number 13
[cs45aa15@mc-redhat01 week-5]$ sed -ie 's/100/(100)/g' regtxt1
[cs45aa15@mc-redhat01 week-5]$ cat regtxt1
I am line one
2 I am
(100) is cost of ticket
two spaces in begin
two spaces at end
line with 5 spaces above
jan
feb
Number 14
[cs45aa15@mc-redhat01 week-5]$ egrep '[0-9]{3}-[0-9]{3}-[0-9]{4}' regtxt2
408-334-9808
415-934-6808
510-534-9808
Number 15
[cs45aa15@mc-redhat01 week-5]$ rm newnums
[cs45aa15@mc-redhat01 week-5]$ egrep '[0-9]{3}-[0-9]{3}-[0-9]{4}' regtxt2 > newnums
[cs45aa15@mc-redhat01 week-5]$ sed -E 's/([0-9]{3})-([0-9]{3})-([0-9]{4})/\3-\2-\3/' newnums
9808-334-9808
6808-934-6808
9808-534-9808