Exercise 1: Convert the contents of the/etc/issue file to uppercase and save to the/tmp/issue.out file
[[Email protected] ~]# TR [: Lower:] [: Upper:] >/tmp/issue.out </etc/issue [[email protected] ~]# TR ' A-Z ' A-Z ' &G T /tmp/issue.out </etc/issue use tee to output to a file while displaying [[email protected] ~]# TR ' A-Z ' A-Z ' </etc/issue | Tee/tmp/issue.outcentos RELEASE 6.8 (FINAL) KERNEL \ r on an \m\l\t\u
Exercise 2: Convert the current system login user's information to uppercase and save to the/tmp/who.out file
[Email protected] wu]# Who-a | TR [: Lower:] [: Upper:] >/tmp/who.out[[email protected] ~]# Who-a | Tr ' A-Z ' A-Z ' >/tmp/who.out
Exercise 3: A Linux user sends an email to root asking for a message titled "Help" with the following message: Hello, I am username, the systemversion is here,pleasehelp me to check it,thanks! Operating system Version Information
echo "Hello, I am $USER, the system version is here, please help me to check it, thanks! > ' Cat/etc/centos-release ' | Mail-s Help Root
Exercise 4: The/root/file list is displayed as a line, separated by a space between the filenames.
M1:echo ' ls/root ' al3a Documents install.log.syslog Music templatesm2:[[email protected] ~]# Ls/root | Tr ' \ n '
Exercises the contents of the 5:file1 file are: "1 2 3 4 5 6 7 8 9 10" Calculates the sum of all numbers
[[email protected] ~]# seq-s ' 1 9 > F[[email protected] ~]# cat F1 2 3 4 5 6 7 8 9[[email protected] ~]# echo $ ((' t R ' + ' < f ')) 45
Exercise 6: Remove the ' ^m ' character from the Windows text file
Tr-d "\ r" < Oldfile > newfile# "^m", you need to type with CTRL + V + CTRL + M
Exercise 7: Handling the string "Xt.,l 1 jr#! $mn 2 c*/fe3 uz4", keeping only the numbers and spaces
[[email protected] ~]# echo ' xt.,l 1 jr#! $mn 2 c*/fe3 uz4 ' > F[[email protected] ~]# TR-CD [:d igit:] < f1234
0728 Day work