随笔分类 - linux shell
摘要:1、测试数据 [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s 2、将第2行替换为xxxx [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8
阅读全文
摘要:1、测试数据如下: [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s 2、在第2行后插入xxxx [root@centos79
阅读全文
摘要:1、测试数据如下: [root@centos79 test]# ls a.txt b.txt [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s [root@centos79 test]# c
阅读全文
摘要:1、测试数据 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt 3 4 5 d g 3 s g 8 k s g 2 5 d s c w a r t e 4 s 2、删除第二行 [root@centos79 test]# ca
阅读全文
摘要:centos中安装那个cmake。 1、问题 [root@PC3 home]# cmake bash: cmake: command not found... Similar command is: 'make' 当前系统: [root@PC3 home]# lsb_release -a LSB V
阅读全文
摘要:1、 [root@centos79 test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@centos79 test]# sed '/2/ s/^/xxx/' a.txt 1 xxx2 3 4 5 6 7 8 9 10 [root@centos79 test]# s
阅读全文
摘要:1、测试数据如下: [root@centos79 test]# seq 10 > a.txt [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 2、提取第2行 [root@cento
阅读全文
摘要:linux系统中find命令 1、直接查找文件名 测试文件如下: [root@centos79 test]# ls 01.txt 02.csv 02.txt 03.csv 04.txt [root@centos79 test]# find "02.txt" 02.txt [root@centos79
阅读全文
摘要:1、查看环境变量 [root@centos79 tmp]# export | wc -l 29 [root@centos79 tmp]# export declare -x HISTCONTROL="ignoredups" declare -x HISTSIZE="1000" declare -x
阅读全文
摘要:1、rename命令 [root@centos79 test]# ls a.mp4 dup1.mp4 dup2.mp4 dup4.mp4 [root@centos79 test]# rename mp4 txt *.mp4 [root@centos79 test]# ls a.txt dup1.tx
阅读全文
摘要:1、别名配置文件为 ~/.bashrc. 例如将:为‘echo $?’命令指定别名为q: [root@centos79 ~]# vim ~/.bashrc # .bashrc # User specific aliases and functions alias rm='rm -i' alias c
阅读全文
摘要:1、tr命令 -s 参数将多个连续的字符压缩为一个字符 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt aaabbbaaaccc a a bbbb ddddcccc [root@centos79 test]# tr -s
阅读全文
摘要:1、split按文件大小拆分文件 测试数据如下: [root@centos79 test]# dd if=/dev/zero bs=1M count=100 of=a.txt 100+0 records in 100+0 records out 104857600 bytes (105 MB) co
阅读全文
摘要:1、测试数据 [root@centos79 test]# cat a.txt a g a d g d a d g d g e g d a a a a d g d a a [root@centos79 test]# awk -F "a" '{print NF - 1}' a.txt ## 统计每行a出
阅读全文
摘要:1、测试数据 [root@centos79 test]# ls a.txt b.txt [root@centos79 test]# cat a.txt a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 [root@centos79 test]# cat b.txt b1 b2 b3 b4
阅读全文
摘要:1、删除开头的空行 [root@centos79 test]# cat a.txt a g r e i x k like a f g liker a g r e a f g liker [root@centos79 test]# cp a.txt a.txt.bak [root@centos79 t
阅读全文
摘要:1、 [root@centos79 test]# echo $a [root@centos79 test]# a=10 [root@centos79 test]# echo $a 10 [root@centos79 test]# unset a ## 清除变量a [root@centos79 tes
阅读全文
摘要:1、在所有行后添加空行 [root@centos79 test]# cat a.txt a g r e i x k like a f g liker s t 2 a b d s i [root@centos79 test]# awk '{print $0 "\n"}' a.txt a g r e i
阅读全文
摘要:1、测试数据如下 [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat -A a.txt a g r e$ $ $
阅读全文
摘要:linux系统中如何删除空行。 1、测试数据 a.txt [root@centos79 test]# ls a.txt [root@centos79 test]# cat a.txt a g r e i x k like a f g liker [root@centos79 test]# cat -
阅读全文

浙公网安备 33010602011771号