记一次过滤文件内容,三剑客awk、grep、sed过滤指定字段、列后,怎料其中混杂编码字符串,这不是我们想要的。所幸,找到了规律,那就是 它 很长…,直接干掉长字符串即可! 下边是三把剑具体实现! 我有三把剑,一把awk,一把grep,一把sed 如看官所愿,得到字符串的长度 5 各位看官,江湖再会!
三剑客过滤长字符串
[root@centos]# cat test hello helloword test66
awk式
[root@centos]# echo "hello" | awk '{print length($1)}' 5
[root@centos]# awk '{ if ( length($0) <=6 ) print $0}' test hello test66
grep式
[root@centos]# egrep -w '^.{1,6}' test hello test66
sed式
[root@centos]# sed -n '/^.{7,}/!p' test hello test66
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算