7.28布置的作业
2016-07-29 08:41
253 查看
2016年7月29日,星期五
1、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中
Hello, I am 用户名,the system version is here,pleasehelp me to check it ,thanks!
操作系统版本信息
cat -A 20.txt |tr -d '^M'
1、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中
[root@localhost /]# cat /etc/issue | tr 'a-z' 'A-Z' > /tmp/issue.out [root@localhost /]# cat /tmp/issue.out \S KERNEL \R ON AN \M [root@localhost /]# cat /etc/issue \S Kernel \r on an \m2、将当前系统登录用户的信息转换为大写后保存至/tmp/who.out文件中
[root@localhost /]# echo $(who) | tr 'a-z' 'A-Z' > /tmp/who.out [root@localhost /]# cat /tmp/who.out ROOT :0 2016-07-26 10:49 (:0) ROOT PTS/0 2016-07-26 11:01 (:0) ROOT PTS/1 2016-07-28 09:56 (10.1.250.28) ROOT TTY2 2016-07-27 15:033、一个linux用户给root发邮件,要求邮件标题为”help”,邮件正文如下:
Hello, I am 用户名,the system version is here,pleasehelp me to check it ,thanks!
操作系统版本信息
[qzx@localhost ~]$ echo -e "Hello, I am $(whoami),the system version is here,pleasehelp me to check it ,thanks"'!'"\n"`cat /etc/redhat-release` | mail -s "help" root [qzx@localhost ~]$ exit 登出 [root@localhost ~]# mailHeirloom Mail version 12.5 7/5/10. Type ? for help. "/var/spool/mail/root": 1 message 1 new>N 1 qzx Thu Jul 28 20:10 18/717 "help" & 1Message 1: From qzx@localhost.localdomain Thu Jul 28 20:10:33 2016 Return-Path: <qzx@localhost.localdomain>X-Original-To: root Delivered-To: root@localhost.localdomainDate: Thu, 28 Jul 2016 20:10:33 +0800 To: root@localhost.localdomainSubject: help User-Agent: Heirloom mailx 12.5 7/5/10 Content-Type: text/plain; charset=us-ascii From: qzx@localhost.localdomain (qzx) Status: R Hello, I am qzx,the system version is here,pleasehelp me to check it ,thanks! CentOS Linux release 7.2.1511 (Core) &4、将/root/下文件列表,显示成一行,并文件名之间用空格隔开
[root@localhost ~]# ls -1 /root/ | tr '\n' ' ' acd anaconda-ks.cfg asd file1 help.test initial-setup-ks.cfg 公共 模板 视频 图片 文档 下载 音乐 桌面5、file1文件的内容为:”1 2 3 4 5 6 7 8 9 10” 计算出所有数字的总和
[root@localhost ~]# echo "1 2 3 4 5 6 7 8 9 10" > file1 [root@localhost ~]# cat file1 | tr ' ' '+' |bc556、删除Windows文本文件中的'^M'字符
cat -A 20.txt |tr -d '^M'
^M$ ^M$ ^M$ ^M$ ^M$ [qzx@localhost 桌面]$ cat -A 20.txt |tr -d '^M' $ aewqf$ sad$ ad$ q$ $ sda$ $ asdq$7、处理字符串“xt.,l 1 jr#!$mn2 c*/fe3 uz4”,只保留其中的数字和空格
[root@localhost ~]# echo "xt.,l 1 jr#historymn2 c*/fe3 uz4"| tr -d '[:alpha:][:punct:]' 1 2 3 48、将PATH变量每个目录显示在独立的一行
[root@localhost ~]# echo $PATH | tr ':' '\n' /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /root/bin9、删除指定文件的空行
[root@localhost ~]# cat file1 | tr -s '\n' adsfasf a fsf fsa afsa asfsa afasfa qfwf10、将文件中每个单词(字母)显示在独立的一行,并无空行
[root@localhost ~]# cat file1 adsfasf a fsf fsa afsa asfsa afasfa qfwf aaaaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaaa sss sss sss t: f [root@localhost ~]# cat file1 | tr -s ' [:punct:]' '\n' adsfasf a fsf fsa afsa asfsa afasfa qfwf aaaaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaaa sss sss sss t f
相关文章推荐
- 自己做的老贺布置的作业,关于apple的硬件产品
- 贪心,布置作业
- 老师布置的我实训作业一部分:安全登录注册系统----登陆客户端
- 老师布置作业“牛&quot;的问题
- 老师又布置作业了... 痛苦
- 项目中的体会-老师布置作业界面
- ace布置小作业: 制作一个简单的电话号码归属地查询软件:JSON解析和Volly发送get请求
- 老师给我布置的实训作业-安全登录注册系统------注册界面的实现(1)
- 贴一个数据结构老师布置的作业(各种排序) c 语言实现
- 老师布置的作业,想到我头疼
- 7作业布置.avi---接口作业
- 老师布置的几道作业
- 请各位大侠帮下忙,小弟刚学java不久,老师就布置了一个大作业
- 刚学51单片机 写了个小程序 分享一下(初学者能力有限,望大家多多指导,懂得布置个作业给我也行,呵呵)
- 当老师布置了错误的实验作业
- 9.18作业布置
- 49讲 函数使用注意事项② 函数作业布置
- 嘿嘿,前几天老师布置的作业:将数字转换成中文大写货币。看看我写的怎样。。
- 教师如何在博客园开班级博客布置作业
- 【c语言】完成的老师布置的第一次作业