[root@hf-01 ~]# > 2.txt [root@hf-01 ~]# cat 2.txt [root@hf-01 ~]#
[root@hf-01 ~]# cat 3.txt asda 123 fgdg,45 1 abc cda abc 1 [root@hf-01 ~]# sort 3.txt |uniq -c |tee a.txt 2 1 1 123 fgdg,45 2 abc 1 asda 1 cda [root@hf-01 ~]# cat a.txt 2 1 1 123 fgdg,45 2 abc 1 asda 1 cda [root@hf-01 ~]#
[root@hf-01 ~]# sort 3.txt |uniq -c |tee -a a.txt 2 1 1 123 fgdg,45 2 abc 1 asda 1 cda [root@hf-01 ~]# cat a.txt 2 1 1 123 fgdg,45 2 abc 1 asda 1 cda 2 1 1 123 fgdg,45 2 abc 1 asda 1 cda [root@hf-01 ~]#
[root@hf-01 ~]# echo "hanfeng" |tr '[hf]' '[HF]' HanFeng [root@hf-01 ~]# echo "hanfeng" |tr 'h' 'H' Hanfeng [root@hf-01 ~]# echo "hanfeng" |tr '[a-z]' '[A-Z]' HANFENG [root@hf-01 ~]#
[root@hf-01 ~]# echo "hanfeng" |tr '[a-z]' '[1]' //错误示范,这样写会出错 ]1]]]]] [root@hf-01 ~]# echo "hanfeng" |tr '[a-z]' '1' //在替换成数字的时候,须要去除方括号 1111111 [root@hf-01 ~]#
[root@hf-01 ~]# find /etc/ -type f -name "*conf" -exec cat {} >>a.txt \; //将etc目录下全部文件以conf结尾的文件全都输出重定向到a.txt文件中 [root@hf-01 ~]# du -sh a.txt 252K a.txt [root@hf-01 ~]# mv a.txt 111/ //把a.txt文件移动到111目录下 [root@hf-01 ~]# cd 111/ //切换到111目录下 [root@hf-01 111]# ls a.txt [root@hf-01 111]# split -b 1000 a.txt //单位是字节(1000byte=1k) [root@hf-01 111]# ls a.txt xbe xcj xdo xet xfy xhd xii xjn xks xlx xnc xoh xpm xqr xrw xtb xaa xbf xck xdp xeu xfz xhe xij xjo xkt xly xnd xoi xpn xqs xrx xtc xab xbg xcl xdq xev xga xhf xik xjp xku xlz xne xoj xpo xqt xry xtd xac xbh xcm xdr xew xgb xhg xil xjq xkv xma xnf xok xpp xqu xrz xte 等等等,只截取了一小部分 [root@hf-01 111]# du -sh //查看目录下文件大小 2.3M . [root@hf-01 111]# du -sh * //会看到分割出来的都占据了一个块 252K a.txt 4.0K xaa 4.0K xab 4.0K xac 4.0K xad 等等等,只截取了一小部分 [root@hf-01 111]# rm -f x*
在切割一个文件,在不指定任何的文件名,最后显示的切割完的文件,会是已xab,xac这样一直延续下去,若再切割一次,则会zxaaa,zxaab等依次下去code
[root@hf-01 111]# [root@hf-01 111]# split -b 100k a.txt [root@hf-01 111]# ls a.txt xaa xab xac [root@hf-01 111]# du -sh * 252K a.txt 100K xaa 100K xab 52K xac [root@hf-01 111]# rm -f x* [root@hf-01 111]#
[root@hf-01 111]# split -b 100k a.txt abc [root@hf-01 111]# ls abcaa abcab abcac a.txt [root@hf-01 111]# split -b 100k a.txt abc. [root@hf-01 111]# ls abcaa abc.aa abcab abc.ab abcac abc.ac a.txt [root@hf-01 111]# rm -f abc*
切割的文件默认是以x开头!!!qt
[root@hf-01 111]# split -l 1000 a.txt [root@hf-01 111]# ls -l 总用量 512 -rw-r--r--. 1 root root 256144 11月 18 06:41 a.txt -rw-r--r--. 1 root root 44741 11月 18 06:59 xaa -rw-r--r--. 1 root root 44239 11月 18 06:59 xab -rw-r--r--. 1 root root 44320 11月 18 06:59 xac -rw-r--r--. 1 root root 34153 11月 18 06:59 xad -rw-r--r--. 1 root root 38618 11月 18 06:59 xae -rw-r--r--. 1 root root 34693 11月 18 06:59 xaf -rw-r--r--. 1 root root 15380 11月 18 06:59 xag [root@hf-01 111]# wc -l * 6548 a.txt 1000 xaa 1000 xab 1000 xac 1000 xad 1000 xae 1000 xaf 548 xag 13096 总用量 [root@hf-01 111]#