马哥教育面授班-7月28号作业
1 、将/etc/issue 文件中的内容转换为大写后保存至/tmp/issue.out 文件中
[[email protected] ~]# tr ‘a-z‘ ‘A-Z‘ </etc/issue | >> /tmp/issue.out [[email protected] ~]# cat /tmp/issue.out CENTOS RELEASE 6.8 (FINAL) KERNEL \R ON AN \T \N \D \S MAGE EDUCATION LEARNING SERVICES HTTP://WWW.MAGEDU.COM [[email protected] ~]#
2 、将当前系统登录用户的信息转换为大写后保存至/tmp/who.out 文件中
[[email protected] ~]# whoami | tr ‘a-z‘ ‘A-Z‘ >/tmp/who.out [[email protected] ~]# cat /tmp/who.out ROOT
3 、一个linux 用户给root 发邮件,要求邮件标题为”help” ,邮件正文如下:
Hello, Iam 用户名,thesystem version is here,please help me to
check it,thanks!
操作系统版本信息
[[email protected] ~]# echo -e "Hello, I am `whoami` ,the system version is here,please help me to \ncheck it ,thanks! \n`cat /etc/centos-release`" | mail -s "help" root [[email protected] ~]# cat /var/spool/mail/root
效果图
4 、将/root/ 下文件列表,显示成一行,并文件名之间用空格隔开
[[email protected] ~]# ls -1 | tr ‘\n‘ ‘ ‘ 1.log 2.log aa [a,b,c,d,e,f [a-c] anaconda-ks.cfg etcs f f[a-c] file1 install.log install.log.syslog mail mail.txt network pass testdir w2c
5 、file1 文件 的 内容为:”1 2 3 4 5 6 7 89 10” 计算出所有数字的总和
[[email protected] ~]# echo "1 2 3 4 5 6 7 8 9 10" > file1 | cat file1 | tr ‘ ‘ ‘+‘ | bc 55
6 、删除Windows 文本文件中的‘^M‘ 字符
[[email protected] ~]# echo "Windows" | tr -d "W" indows
7 、处理字符串“xt.,l 1 jr#!$mn 2 c*/fe 3 uz 4 ”,只保留其中的数字和空格
[[email protected] ~]# echo "xt.,|1 jr#/rootmn 2 c*/fe 3 uz 4" | tr -d -c ‘0-9 \n‘ 1 2 3 4
时间: 2024-10-12 11:38:30