Skip to content

Unable to grep output of command #25935

Answered by BrightRan
therealkris asked this question in Actions
Discussion options

You must be logged in to vote

@therealkris,

The variable config_id comes from this line: config_id=$(echo ${services} | grep -ioE '\d+\-\d+\-\d+[a-z]\d+') .

Ah, yes, I missed it.
Now I seem find the reason that way the command fails to get the configuration ID.

In the grep command, it seems does not recognize the metacharacter ‘\d’ in the regular expression “\d+\-\d+\-\d+[a-z]\d+”.
I know, generally many people (include me) are used to using the metacharacter ‘\d’ instead of '[0-9]‘ to represent the digital characters in the regular expression.
However, I find that some command line interfaces do not recognize the metacharacter ‘\d’, and they seem to prefer the metacharacter '[0-9]‘.
Maybe in some environments, the …

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants