![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux_shell
Jayccccc_chao
万般皆下品 惟有读书高
展开
-
echo显示彩色字体
str="test_str"echo -e "\033[效果;背景颜色;字体颜色 ${str} \033[0m" #黑色字体颜色# 31m 红色# 32m 绿色# 33m 黄色# 34m 蓝色# 35m 紫色# 36m 青色# 37m 白色背景颜色# 40 黑色# 41 红色# 42 绿色# 43 黄色# 44 蓝色# 45 紫色# 46 青色# 47 ...原创 2018-11-29 11:57:56 · 738 阅读 · 1 评论 -
shell命令--nl
先上一段比较常用的脚本#!/bin/bashnl -b a test.txt #显示test.txt文本的行数,包括空行。nl -b a test.txt |grep "text" |awk '{print $1}' #找出匹配text的行,并将行号打印出来sed -n '3,5 p' test.txt #打印test.txt 3-5行的内容 -b 表示使用指定的样式编号文件内...原创 2018-12-04 10:06:12 · 486 阅读 · 0 评论 -
Linux shell命令--sed
转自:http://blog.csdn.net/wl_fln/article/details/7281986Sed简介sed是一种在线编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不断重复,直到文件末尾。文件内容并没有 改变,除...转载 2018-12-04 10:33:05 · 150 阅读 · 0 评论 -
linux shell--list
list的基本用法#/bin/bashlist=(1,2,3)list1=("a", "b", "c")#get list lenlen_list=${#list[@]}#get itemitem=${list[0]}#for loopfor item in ${list[@]}do echo ${item}done#example (list lsu...原创 2018-12-05 17:53:07 · 8761 阅读 · 0 评论 -
linux查找文本文件
转载出处:https://www.cnblogs.com/huninglei/p/5824205.html在使用linux时,经常需要进行文件查找。其中查找的命令主要有find和grep。两个命令是有区的。 区别:(1)find命令是根据文件的属性进行查找,如文件名,文件大小,所有者,所属组,是否为空,访问时间,修改时间等。 (2)grep是根据文件的内...转载 2018-12-20 15:19:15 · 2920 阅读 · 0 评论 -
linux--字符串分割
第一种使用cut:一般常用的命令echo "hello world" |cut -d" " -f1 #helloecho "hello world" |cut -d" " -f2#worldecho "hello world" |cut -d" " -f1-#hello worldecho "hello world" |cut -c 1#he原创 2018-12-27 15:47:48 · 15848 阅读 · 1 评论 -
shell命令之tr
先看看tr的帮助文档:tr命令就是对标准输入进行翻译、压缩、删除等操作举个栗子:#!/usr/bin/env bash#replaceecho "Hello Tr" |tr "HT" "ht"# replace H to h,T to t.#output hello tr#squeezeecho "Hello Tr" |tr -s " "#outpu...原创 2018-12-17 19:10:20 · 137 阅读 · 0 评论