当前位置:网站首页>第四次作业:关于cat,grep,cut,sort,uniq,vim,tr等命令的用法
第四次作业:关于cat,grep,cut,sort,uniq,vim,tr等命令的用法
2022-07-22 18:11:00 【cy11114】
今日作业:
1.文件内容浏览
a.cat查看/etc/passwd文件内容,且输出时带行号
b.使用more/less查看/etc/passwd内容,且每页显示10行
c.使用head/tail分别查看文件前5行内容和后5行内容
d.使用grep查看/etc/passwd中和root相关的内容
2.cut命令使用:
给定文件cut_data.txt且内容为:
No Name Score
1 zhang 20
2 li 80
3 wang 90
4 sun 60
使用默认定界符切割文件内容,且输出切割后的第一个字段
切割文件内容,且输出切割后的第一个字段和第三个字段
按字节切割:输出切割的第一个字节到第10个字节的内容
按字符切割:输出切割后的第一个字符和第5个字符的内容
按指定分界符去切割:内容如下, 输出第一个字段和第三个字段内容
No|Name|Score
1|zhang|20
2|li|80
3|wang|90
4|sun|60
3.uniq命令使用: 新建文件uniq_data.txt,文件内容为
Welcome to Linux
Windows
Windows
Mac
Mac
Linux
使用uniq命令输出去重后的结果
使用uniqmingl只输出重复的行
使用uniq命令输出不重复的行
使用uniq命令统计重复次数
4.sort命令:给定文件 num.txt, args.txt
文件内容:num.txt
1
3
5
2
4
文件内容:args.txt
test
args1
args2
args4
args4
args3
对num.txt进行排序,且将结果输出到sorted_num.txt中
对args.txt进行排序,且将结果输出到sorted_args.txt中
对num.txt和args.txt进行排序,且将结果输出到sorted_merge.txt中
对args.txt排序后去重输出
合并sorted_args.txt和sorted_num.txt且输出
给定文件info_txt:按第二列作为key进行排序
No Name Score
1 zhang 20
2 li 80
3 wang 90
4 sun 60
5.将26个小写字母的后13个字母替换成大写字母
将hello 123 world 456中的数字替换成空字符
将hello 123 world 456中字母和空格替换掉,只保留数字

边栏推荐
猜你喜欢

STM32学习—DHT11温湿度传感器采样驱动并用cjson格式上报

Selenium基础知识 多窗口处理

Day 2 summary and test case operation

beanshell处理json的技巧

03. Design of large-scale high parallel micro service system

Lire la lecture efficace - l'auto - investissement le plus rentable

Source code compilation and installation lamp

Selenium基础知识 自动登录百度网盘

Basic process of unit approval

Learn the MD of amber t3.3: implicit solvent model (GB)
随机推荐
LIinux下的基本C编程的三类高频函数操作详解第一类——文件操作函数(f)
十月随笔
最近acm的一些感悟以及未来的一些想法
Test point, summary of the first day
appium 使用
信息收集的基础要素
get请求和post请求区别
zstuAcm学生信息库的建立(用链表完成)
文件目录权限
October essay
About count=count++
APUE进程深层理解fork和execl-程序代码里获取虚拟机IP地址
关于如何在终端设置有颜色的字体
【调研信息搜集的内容,信息搜集的方法,信息搜集的工具,信息搜集结果的利用等调研报告】
Determine whether the course exists in the set, and use the contains method
Basic process of visitors
Source code compilation and installation lamp
关于使用VMD的对齐功能
Lire la lecture efficace - l'auto - investissement le plus rentable
嵌入式系统移植【3】——uboot的烧写及使用