BASH – 计算文件中类似行的数量
发布时间:2020-12-16 01:12:12 所属栏目:安全 来源:网络整理
导读:我在一个论坛上有一个主题,人们可以写出他们的十大歌曲列表.我想计算一首歌被列出的次数.必须比较相似性不区分大小写. 文件结构示例: Join Date: Apr 2005Location: bama via new orleansAge: 48Posts: 2,369Re: Top 10 Songs Jethro Tulloh dearrrr. the o
我在一个论坛上有一个主题,人们可以写出他们的十大歌曲列表.我想计算一首歌被列出的次数.必须比较相似性不区分大小写.
文件结构示例: Join Date: Apr 2005 Location: bama via new orleans Age: 48 Posts: 2,369 Re: Top 10 Songs Jethro Tull oh dearrrr. the only way for all kaths to keep their last shred of sanity: fly through this list as quickly as possible,without stopping to think for a microsecond... velvet green dun ringill skating away on the thin ice of a new day sossity yer a woman fat man life's a long song jack-a-lynn teacher mother goose elegy 03-10-2010,02:29 AM #5 (permalink) Sox Avoiding The Swan Song Join Date: Jan 2010 Location: Derbyshire,England Age: 43 Posts: 5,991 Re: Top 10 Songs Jethro Tull Wow !!!! Where do I start ? Dun Ringill Aqualung With You There To Help Me Jack Frost And The Hooded Crow We Used To Know Witch's Promise Pussy Willow Heavy Horses My Sunday Feeling Locomotive Breath Join Date: Nov 2009 Posts: 1,418 Re: Top 10 Songs Jethro Tull Too bad they all can't make the list,but here's ten I never get tired of listening to: Christmas Song Witches Promise Life's A Long Song Living In The Past Rainbow Blues Sweet Dream Minstral In The Gallery Cup of Wonder Rover Something's On the Move 输出示例: life's a long song 3 aqualung 1 ...
你的文件“结构”在结构部门中有点缺乏,所以你必须处理这个过程中的一些错误.
假设您在名为input的文件中拥有所有内容,请尝试: tr '[A-Z]' '[a-z]' < input | egrep -v "^ *(join date|age|posts|location|re):" | sort | uniq -c 第一行缩小所有内容,第二行删除样本中看起来像电子邮件标题的内容,然后对唯一项进行排序和计数. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |