linux shell里字符的处理
head
tail
wc README
207 1923 13011 README
line words character
wc -l
wc -w
wc -c
uniq unique的缩写,将相邻的重复行去除 ::uniq file1
sort -u 先排序,再将相邻的重复行删除,-u 表示unique
uniq -c 可以发现出现重复的共有几行
paste 将几个不同文件内容放一起,各个文件行的水平放置,每个文件的行用Tab分割
user1:/home/xuser1>paste testvi1 testvi2 testvi3 >tests
user1:/home/user1>cat tests
test1 test2 test3
user1:/home/user1>cat testvi1 testvi2 testvi3 >tests2
user1:/home/user1>cat tests2
test1
test2
test3
tr 字符转义器
tr 'A-Z' 'a-z' < .bash_profile
将.bash_profile中大写的A-Z转成小写的a-z
unix $ --> Dos \r
cat -A file1 显示所有文件内容,包括回车
cat -A tests2 |tr '$' '\r' >tests3
dos2unix 、unix2dos 也可做这些
diff 比较文件
< 第一个文件
> 第二个文件
sdiff file1 file2 更方便阅读
aspell 检查英文单词拼写是否正确
aspell check file1
look命令快速查询单词拼写是否正确
look exer
format字符串的一些命令
expand 将Tab转换成空格
fmt 格式化段落 -u统一的空格设定 -w设定列宽度
fmt -u -w50 file1
pr 按打印机格式格式化
pr /usr/share/dict/words |more
pr -5 /usr/share/dict/words |more 每行5列
head
tail
wc README
207 1923 13011 README
line words character
wc -l
wc -w
wc -c
uniq unique的缩写,将相邻的重复行去除 ::uniq file1
sort -u 先排序,再将相邻的重复行删除,-u 表示unique
uniq -c 可以发现出现重复的共有几行
paste 将几个不同文件内容放一起,各个文件行的水平放置,每个文件的行用Tab分割
user1:/home/xuser1>paste testvi1 testvi2 testvi3 >tests
user1:/home/user1>cat tests
test1 test2 test3
user1:/home/user1>cat testvi1 testvi2 testvi3 >tests2
user1:/home/user1>cat tests2
test1
test2
test3
tr 字符转义器
tr 'A-Z' 'a-z' < .bash_profile
将.bash_profile中大写的A-Z转成小写的a-z
unix $ --> Dos \r
cat -A file1 显示所有文件内容,包括回车
cat -A tests2 |tr '$' '\r' >tests3
dos2unix 、unix2dos 也可做这些
diff 比较文件
< 第一个文件
> 第二个文件
sdiff file1 file2 更方便阅读
aspell 检查英文单词拼写是否正确
aspell check file1
look命令快速查询单词拼写是否正确
look exer
format字符串的一些命令
expand 将Tab转换成空格
fmt 格式化段落 -u统一的空格设定 -w设定列宽度
fmt -u -w50 file1
pr 按打印机格式格式化
pr /usr/share/dict/words |more
pr -5 /usr/share/dict/words |more 每行5列