【问题标题】:Which linux command is used to find numbers or words between two different characters (first will be a word and last will be symbol)? [closed]哪个 linux 命令用于查找两个不同字符之间的数字或单词(第一个是单词,最后一个是符号)? [关闭]
【发布时间】:2022-01-19 07:32:34
【问题描述】:
“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'

【问题讨论】:

  • 不:(那段与我的要求无关,那些是机密的,这就是为什么我改变了整个。我只想知道那个特定语句的 linux 命令。
  • 认为您正在寻找grep,但是由于您标记了此Linux,我不知道您是否需要命令行实用程序或系统调用。

标签: linux ubuntu unix


【解决方案1】:

试试这个:

#! /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 是生成随机文本数据的好方法,每个人都很容易理解。有许多在线生成器可用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多