Skip to content

Add a prefix and a suffix to a string #647

Answered by aborruso
NikosAlexandris asked this question in Q&A
Discussion options

You must be logged in to vote

And, why not including the _SUFF in the sub example? I.e. how to do prefix and suffix in one step using sub?

What about using regex syntax

Running echo 'a=hello' | mlr put -S '$a=sub($a,"^(.+)$","PRE_"."\1"."_SUFF")' you will have a=PRE_hello_SUFF

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
6 replies
@NikosAlexandris
Comment options

@aborruso
Comment options

@NikosAlexandris
Comment options

@NikosAlexandris
Comment options

@trantor
Comment options

Comment options

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

You must be logged in to vote
2 replies
@NikosAlexandris
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants