[root@localhost shell]# cat student.txt ID Name Gender Mark 1 ming F 85 2 zhang F 70 3 wang M 75 4 li M 90 [root@localhost shell]# cut -f 4 student.txt Mark 85 70 75 90
[root@localhost shell]# cat student.csv ID,Name,Gender,Mark 1,ming,F,85 2,zhang,F,70 3,wang,M,75 4,li,M,90 [root@localhost shell]# cut -d "," -f 4 student.csv Mark 85 70 75 90
[root@localhost shell]# echo "abcdef" | cut -c 3 c
[root@localhost shell]# echo "Shell编程" | cut -nb 1 S [root@localhost shell]# echo "Shell编程" | cut -nb 2 h [root@localhost shell]# echo "Shell编程" | cut -nb 3 e [root@localhost shell]# echo "Shell编程" | cut -nb 4 l [root@localhost shell]# echo "Shell编程" | cut -nb 5 l [root@localhost shell]# echo "Shell编程" | cut -nb 8 编 [root@localhost shell]# echo "Shell编程" | cut -nb 11 程
[root@localhost ~]# printf '%i %s %i %s %i\n' 1 "+" 2 "=" 3 1 + 2 = 3 [root@localhost ~]# printf '%i-%i-%i %i:%i:%i\n' 2015 12 3 21 56 30 2015-12-3 21:56:30
[root@localhost shell]# cat student.txt
ID Name Gender Mark
1 ming F 85
2 zhang F 70
3 wang M 75
4 li M 90
[root@localhost shell]# awk '{print $1 "\t" $4}' student.txt
ID Mark
1 85
2 70
3 75
4 90
[root@localhost shell]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 2.4G 14G 15% /
/dev/sda1 289M 16M 258M 6% /boot
tmpfs 411M 0 411M 0% /dev/shm
[root@localhost shell]# df -h | grep "sda1" | awk '{print $5}'
6%
[root@localhost shell]# cat student.txt ID Name Gender Mark 1 ming F 85 2 zhang F 70 3 wang M 75 4 li M 90#测试-n参数 [root@localhost shell]# sed -n '2p' student.txt 1 ming F 85#测试单行删除 [root@localhost shell]# sed '2d' student.txt ID Name Gender Mark 2 zhang F 70 3 wang M 75 4 li M 90#测试多行删除 [root@localhost shell]# sed '2,4d' student.txt ID Name Gender Mark 4 li M 90#测试追加 [root@localhost shell]# sed '2a test append' student.txt ID Name Gender Mark 1 ming F 85 test append 2 zhang F 70 3 wang M 75 4 li M 90#测试插入 [root@localhost shell]# sed '2i test insert' student.txt ID Name Gender Mark test insert 1 ming F 85 2 zhang F 70 3 wang M 75 4 li M 90#测试行替换 [root@localhost shell]# sed '2c test replace' student.txt ID Name Gender Mark test replace 2 zhang F 70 3 wang M 75 4 li M 90#测试内容替换 [root@localhost shell]# sed '2s/ming/replace/g' student.txt ID Name Gender Mark 1 replace F 85 2 zhang F 70 3 wang M 75 4 li M 90
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有