哪个 linux 命令用于查找两个不同字符之间的数字或单词(第一个是单词,最后一个是符号)?
Which linux command is used to find numbers or words between two different characters (first will be a word and last will be symbol)?
“With clarity and definition is associated *"id"='o123-3923-d2i71-0129p' ,a certain physical spareness. Most of the "id"='s0987-3923-d2i71-0129p' great deciduous trees of England give one the impression, at any rate in summer, of being rather o "id"='p4523-3923-d2i71-0129p' ,bese. In Scandinavian mythology Embla, the elm, was the first woman. Those who have lived "id"='o123-3923-d2i71-0129p' ,much with old elm trees—and I spent a good part of my boyhood under their ponderous shade—will "id"='m0962-3923-d2i71-0129p' ,agree that the Scandinavians were men of insight. There is in effect something blowsily female about those vast trees that brood with all their bulging masses of foliage above the meadows of "id"='o123-3923-d2i71-0129p' ,the home counties.
这里我只想获取id。输出:
"id"='o123-3923-d2i71-0129p' "id"='s0987-3923-d2i71-0129p' "id"='p4523-3923-d2i71-0129p' "id"='o123-3923-d2i71-0129p'"id"='m0962-3923-d2i71-0129p'"id"='o123-3923-d2i71-0129p'
试试这个:
#! /bin/bash
exec <<EOF
“With clarity and definition is associated *"id"='o123-3923-d2i71-0129p' ,a certain physical spareness. Most of the "id"='s0987-3923-d2i71-0129p' great deciduous trees of England give one the impression, at any rate in summer, of being rather o "id"='p4523-3923-d2i71-0129p' ,bese. In Scandinavian mythology Embla, the elm, was the first woman. Those who have lived "id"='o123-3923-d2i71-0129p' ,much with old elm trees—and I spent a good part of my boyhood under their ponderous shade—will "id"='m0962-3923-d2i71-0129p' ,agree that the Scandinavians were men of insight. There is in effect something blowsily female about those vast trees that brood with all their bulging masses of foliage above the meadows of "id"='o123-3923-d2i71-0129p' ,the home counties.
EOF
grep -oP '"id"='\''\w{4,5}-\w{4}-\w{5}-\w{5}'\'
顺便说一句:Lorem ipsum 是生成随机文本数据的好方法,每个人都可以轻松理解。有许多可用的在线生成器。
“With clarity and definition is associated *"id"='o123-3923-d2i71-0129p' ,a certain physical spareness. Most of the "id"='s0987-3923-d2i71-0129p' great deciduous trees of England give one the impression, at any rate in summer, of being rather o "id"='p4523-3923-d2i71-0129p' ,bese. In Scandinavian mythology Embla, the elm, was the first woman. Those who have lived "id"='o123-3923-d2i71-0129p' ,much with old elm trees—and I spent a good part of my boyhood under their ponderous shade—will "id"='m0962-3923-d2i71-0129p' ,agree that the Scandinavians were men of insight. There is in effect something blowsily female about those vast trees that brood with all their bulging masses of foliage above the meadows of "id"='o123-3923-d2i71-0129p' ,the home counties.
这里我只想获取id。输出:
"id"='o123-3923-d2i71-0129p' "id"='s0987-3923-d2i71-0129p' "id"='p4523-3923-d2i71-0129p' "id"='o123-3923-d2i71-0129p'"id"='m0962-3923-d2i71-0129p'"id"='o123-3923-d2i71-0129p'
试试这个:
#! /bin/bash
exec <<EOF
“With clarity and definition is associated *"id"='o123-3923-d2i71-0129p' ,a certain physical spareness. Most of the "id"='s0987-3923-d2i71-0129p' great deciduous trees of England give one the impression, at any rate in summer, of being rather o "id"='p4523-3923-d2i71-0129p' ,bese. In Scandinavian mythology Embla, the elm, was the first woman. Those who have lived "id"='o123-3923-d2i71-0129p' ,much with old elm trees—and I spent a good part of my boyhood under their ponderous shade—will "id"='m0962-3923-d2i71-0129p' ,agree that the Scandinavians were men of insight. There is in effect something blowsily female about those vast trees that brood with all their bulging masses of foliage above the meadows of "id"='o123-3923-d2i71-0129p' ,the home counties.
EOF
grep -oP '"id"='\''\w{4,5}-\w{4}-\w{5}-\w{5}'\'
顺便说一句:Lorem ipsum 是生成随机文本数据的好方法,每个人都可以轻松理解。有许多可用的在线生成器。