Grep
Sample
grep '[0-9]' source.txt : '[0-9]'の文字列 grep -E '([0-9]){2}' source.txt : '[0-9]'が2回続く文字列 grep '[Ll]inux' source.txt : 'Linux'または'linux'を含む grep -w '[Ll]inux' source.txt : 独立した'Linux'または'linux'を含む ('RedhatLinux'などは含まない) grep '[1-9][0-9][0-9][A-Z][0-9]' source.txt : 先頭に0を含まず123A7のようなパターン grep -v '[0-9]' source.txt : 数字を含まない grep '.....' source.txt : 5文字以上の行だけ grep -E '^.{15}a' source.txt : 16文字目が'a' grep '^W.*s$' source.txt : 先頭が'W'で末尾が's'の文字列 grep '^$' source.txt : 空行 grep '.' source.txt : 空行を除外 grep 'ABC.*ABC' source.txt : 'ABC'という文字が2回含む grep -E '(ABC){1,3}' source.txt : 'ABC'という文字が連続して1-3回含む grep -E '[A-Z]{6,15}' source.txt : 大文字アルファベットが連続して6-15文字含む grep -E '[A-Za-z]{6,15}' source.txt : 大文字小文字アルファベットが6-15文字含む grep -E '[^0-9A-Za-z]{6,15}' source.txt : 大文字小文字アルファベットと数字以外の文字が6-15文字含む grep '[0-9]\{3\}-[0-9]\{3\}-[0-9]\{4\}' source.txt : 電話番号'000-000-0000'を含む grep -E '[0-9]{3}-[0-9]{3}-[0-9]{4}' source.txt : 電話番号'000-000-0000'を含む grep "[^ a-zA-Z0-9,.&+-;<>'?:()*]" source.txt : 2-byte文字などを含む grep '[亜-熙ぁ-んァ-ヶ]' source.txt : 日本語を含む
Acknowledgments
Daiphys is a professional-service company for research and development of leading-edge technologies in science and engineering.
Get started accelerating your business through our deep expertise in R&D with AI, quantum computing, and space development; please get in touch with Daiphys today!
Daiphys Technologies LLC - https://www.daiphys.com/