开发者

uniq : only when different by more than 1 character OR case

I got a text file with LOTS of names. I want a list of all the strings(lines) that is eithe开发者_StackOverflow中文版r 1) Different in CASE (i.e audi vs AuDI) 2) Different by more than 1 character ie (mygoo VS my-goo) Any ideas ??


you really mean more than 1 character difference? it would match all words, wouldn't?

if you mean at most X difference(s), you can use agrep fuzzy search.

e.g. for following /tmp/list

bar
foobar
fooBar
foo-bar
foo--bar
spam
toolbar

command

$ agrep -1 foobar /tmp/list

will find:

foobar
fooBar
foo-bar

(it includes the original pattern, which you can filter out, e.g. appending | grep -v '^foobar$')

UPDATE

this is a hint about a tool, which you can use, it might not be exactly what you wanted. please look at -i agrep option as well

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜