Results 1 to 2 of 2
Hello,
I would like to change all references of $233 (any number) to ARG(233) in a text:
$NUMBER -> ARG(NUMBER)
How could I do this with sed or awk?
Thanks ...
- 04-12-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 1
How to change $NUMBER to ARG(NUMBER)
Hello,
I would like to change all references of $233 (any number) to ARG(233) in a text:
$NUMBER -> ARG(NUMBER)
How could I do this with sed or awk?
Thanks in advance,
- 04-12-2011 #2
This sounds like a homework question, but I'll give you a bit of a hint.
sed has the ability to do captures. This allows you to extract some of a match and use that text in the replacement. sed does this by using parentheses in the regular expression, and then \1, \2, \3, etc. in the replacement, where the number is the number of the capture.
Using this, you should be able to write a sed statement that matches a statement like $N and replaces it with ARG(N).DISTRO=Arch
Registered Linux User #388732


Reply With Quote