7.2 Linux 命令行文本处理
来源:互联网 发布:mac win8u盘安装 编辑:程序博客网 时间:2024/06/10 07:57
1.基于关键字搜索
syntax:grep [paramter] "keywords" filepath
[paramter]: -i ignore upper or lower case
-n show the located row number
-v show the row which not contain the "keywords"
-Ax show specific number of rows after the "keywords" located row
-Bx show specific number of rows after the "keywords" located row
eg: find / -user msdomain1\pzhou | grep 'keywords
grep -B3 "peter" /date/file
2. cut基于列处理文本
syntax: cut [paramter] file
paramter: -d point out he seperate words (default tab)
-f point out the numver of column which will be output
-c cut rows by index of character in each row
eg: cut -c2-6 /etc/passwrod show form 2 to 6 character of each row
cut -d: -f1 /ect/passwd
3. wc statistic infor of text
syntax: cut [params] file
params: -l number of rows
-w number of words
-c number of byte
-m number of character
4.sort text
syntax: sort [params] file
params: -r order by desc
-n sort by number
-f ingore upper or lower case
-u delete duplicated row
5.uniq delete duplicated labour rows
syntax: uniq file
6. compare two file
syntax: diff [param] file1 file2
params: -iignore upper or lower case
-bignore blank
-umake a output more uniform(use to make patch file)
7.check spell
syntax: aspell file
8.tranfer file
syntax: tr [params] < filepath
params: -d 'words'delete all 'words'
'a-z' 'A-Z' switch from lower case to upper case
9 replace workds
syntax: sed
eg: sed 's/word1/word2/g' file search(s) and replease all(globally g) word1 to replace word2
sed '1,50s/word1/word2/g' file search and replace for row 1to50
sed -e 's/word1/word2/g' -e 's/word3/word4/g' file iterate replace condition
sed -f conditionfilename file release replace condition from file
syntax:grep [paramter] "keywords" filepath
[paramter]: -i ignore upper or lower case
-n show the located row number
-v show the row which not contain the "keywords"
-Ax show specific number of rows after the "keywords" located row
-Bx show specific number of rows after the "keywords" located row
eg: find / -user msdomain1\pzhou | grep 'keywords
grep -B3 "peter" /date/file
2. cut基于列处理文本
syntax: cut [paramter] file
paramter: -d point out he seperate words (default tab)
-f point out the numver of column which will be output
-c cut rows by index of character in each row
eg: cut -c2-6 /etc/passwrod show form 2 to 6 character of each row
cut -d: -f1 /ect/passwd
3. wc statistic infor of text
syntax: cut [params] file
params: -l number of rows
-w number of words
-c number of byte
-m number of character
4.sort text
syntax: sort [params] file
params: -r order by desc
-n sort by number
-f ingore upper or lower case
-u delete duplicated row
5.uniq delete duplicated labour rows
syntax: uniq file
6. compare two file
syntax: diff [param] file1 file2
params: -iignore upper or lower case
-bignore blank
-umake a output more uniform(use to make patch file)
7.check spell
syntax: aspell file
8.tranfer file
syntax: tr [params] < filepath
params: -d 'words'delete all 'words'
'a-z' 'A-Z' switch from lower case to upper case
9 replace workds
syntax: sed
eg: sed 's/word1/word2/g' file search(s) and replease all(globally g) word1 to replace word2
sed '1,50s/word1/word2/g' file search and replace for row 1to50
sed -e 's/word1/word2/g' -e 's/word3/word4/g' file iterate replace condition
sed -f conditionfilename file release replace condition from file
阅读全文
0 0
- 7.2 Linux 命令行文本处理
- Linux命令行文本处理工具
- Linux命令行文本处理工具
- Linux命令行文本处理工具
- Linux命令行文本处理工具
- Linux命令行文本处理工具
- Linux命令行文本处理工具
- Linux 命令行文本处理工具
- Linux命令行之文本处理
- Linux系列-Linux命令行文本处理
- 14.Linux命令行文本处理工具
- 课时20 Linux命令行文本处理工具
- linux入门基础——linux命令行文本处理工具
- 常用的Linux命令行文本处理工具总结
- Linux入门基础 #10:命令行文本处理工具
- Linux基本配置和管理 3 ---- Linux命令行文本处理工具
- Linux基本配置和管理 3 ---- Linux命令行文本处理工具
- Linux命令行参数处理
- MAC环境如何将本地代码上传到GitHub上
- Object.create()方法的使用
- 7.1 管道、重定向
- Map的KEY值转成大写
- 实体类对象与XML字符串的序列化和反序列化(示例)
- 7.2 Linux 命令行文本处理
- 最佳日志数据实践
- windows 的常用命令
- iterm2 ssh共享socket支持动态免密登录
- [程序员面试金典]-链表分割
- 05.03 Linux安装系统优化部分
- 洛谷 P1094 纪念品分组
- working experience in MST
- linux系统查看日志常用命令