I need a sed/awk script to do the following:
echo 1 2 | script;
"values(1,2)" <= this is the output string.
Thanks in advance!
I need a sed/awk script to do the following:
echo 1 2 | script;
"values(1,2)" <= this is the output string.
Thanks in advance!
try this:
echo 1 2 | awk '{print "values("$1","$2")"}'
Sorry for redundancy, but how it can be done with sed?
echo 1 2 | sed 's/\([0-9]\+\) \([0-9]\+\)/values(\1,\2)/'
Hi,
Hope below one is useful for you!
echo "input"
read val
echo $val | sed 's/[0-9][0-9]* [0-9][0-9]*/values(&)/'
FreeBSD:
[echo 1 2 | sed 's/\([0-9]\+\) \([0-9]\+\)/values(\1,\2)/'
1 2
LinuxGentoo:
echo 1 2 | sed 's/\([0-9]\+\) \([0-9]\+\)/values(\1,\2)/'
values(1,2)
Hi,
I am working unix AIX and the output i got from sed is
WDT001$ echo 1 2 | sed 's/\([0-9]+\) \([0-9]+\)/values(\1,\2)/'
1 2
WDT001$ echo 1 2 | sed 's/\([0-9]\+\) \([0-9]\+\)/values(\1,\2)/'
1 2
'+' is not working for me.
Is there any other way to use + ????
Try:
echo 1 2 | sed -E 's/([0-9]+) ([0-9]+)/values(\1,\2)/'
I got this output:
echo 1 2 | sed -E 's/([0-9]+) ([0-9]+)/values(\1,\2)/'
sed: illegal option -- E
Usage: sed [-n] Script [File ...]
sed [-n] [-e Script] ... [-f Script_file] ... [File ...
i used
echo 1 2 |sed -e 's/\([0-9]\+\) \([0-9]\+\)/values(\1,\2)/'
and got the same output.. ->1 2