GREP如何仅检索指定字母的单词? [英] GREP How do I only retrieve words with only the specified letters?

查看:348
本文介绍了GREP如何仅检索指定字母的单词?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望弄清楚如何用grep完成以下操作(给出一个grep字典文件)


  1. 查找只有仅包含以下字符的单词: dgo



    示例:dog,god

  2. c $ c
    $ b示例:教条,togaed等等。





  ^ [god] + $ $ b $ 

b

全部:

 (?=。* g)(?=。* o)(?=。* d)


I wish to figure out how to do the following with grep (given a dictionary file to grep from)

  1. Find only words that CONTAIN ONLY the following characters: dgo

    Example: dog, god

  2. Finda any words that contains ALL the following characters (at least once): dgo

    Example: dogma, togaed etc...

解决方案

Only:

 ^[god]+$

All:

 (?=.*g)(?=.*o)(?=.*d)

这篇关于GREP如何仅检索指定字母的单词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆