题目:Linux显示/etc下以非字母开头,后面跟了一个字母以及其他任意长度字符的文件或目录
答:
ls -a /etc/ | grep -E ^[^[:alpha:]][[:alpha:]]*
题目:复制以p或者P开头,以非数字结尾的文件或目录到/tmp/mytest1
答:
#创建文件夹 mkdir /tmp/mytest1 #拷贝文件 cp -r /etc/[pP]*[^[:digit:]] /tmp/mytest1 也可以写成如下格式 mkdir /tmp/mytest1; cp -r /etc/[pP]*[^[:digit:]] /tmp/mytest1
题目:将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中
答:
root@CentOS7[16:17:51]:# cat /etc/issue | tr [a-z] [A-Z] >/tmp/issue.out root@CentOS7[16:18:06]:# cat /tmp/issue.out \S KERNEL \R ON AN \M
来源:https://www.cnblogs.com/stationing/p/12011704.html