3.io重定向-重定向练习实验

1、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中

[root@centos7 ~]#cat /etc/issue | tr ‘[:lower:]’ ‘[:upper:]’ > /tmp/issue.out

[root@centos7 data]# tr ‘[:lower:]’ ‘[:upper:]’ < /etc/issue > /tmp/issue.log

2、将当前系统登录用户的信息转换为大写后保存至/tmp/who.out文件中

[root@centos7 ~]#who | tr ‘[:lower:]’ ‘[:upper:]’ | tee /tmp/who.out

[root@centos7 /]#who | tr ‘[:lower:]’ ‘[:upper:]’ > /tmp/who.out

3、一个linux用户给root发邮件,要求邮件标题为”help” ,邮件正文如下:
Hello, I am 用户名,The system version is here,please help me to check it ,thanks!
操作系统版本信息

[root@centos7 Packages]#mail -s help root <<EOF

Hello, I am $USER ,The system version is here,please help me to check it ,thanks!
OS version info
$(lsb_release)
EOF

4、将/root/下文件列表,显示成一行,并文件名之间用空格隔开

[root@centos7 ~]#ls /root/ | tr -s ‘\n’ ’ ’

5、计算1+2+3+…+99+100的总和

[root@centos7 ~]#echo {1…100} | tr ’ ’ ‘+’ |bc

[root@centos7 ~]#seq -s + 100 |bc

6、删除Windows文本文件中的‘^M’ 字符

7、处理字符串“xt.,l 1 jr#!$mn 2 c*/fe 3 uz 4”,只保留其中的数字和空格

[root@centos7 ~]#echo “xt.,l 1 jr#bcmn 2 c*/fe 3 uz 4” | tr -dc ‘[:digit:][:blank:]’

[root@centos7 ~]#echo “xt.,l 1 jr#bcmn 2 c*/fe 3 uz 4” | tr -dc '0-9 ’

8、将PATH变量每个目录显示在独立的一行

[root@centos7 ~]#echo $PATH | tr ‘:’ ‘\n’

9、 将指定文件中0-9分别替代成a-j

[root@centos7 data]#tr ‘0-9’ ‘a-j’ < 2e

10、将文件/etc/centos-release中每个单词(由字母组成)显示在独立的一行,并无空行

[root@centos7 data]#cat /etc/centos-release | tr ’ ’ ‘\n’

https://blog.csdn.net/qq_37996875/article/details/81278996

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值