Need to convert
echo "7 6"
to
$7,$6
But the count of numbers can increase say echo "7,6,8,9" tried this didn't work
echo "7 6" | sed 's/\([0-9]*\)/\1/'
But did not help much
Need to convert
echo "7 6"
to
$7,$6
But the count of numbers can increase say echo "7,6,8,9" tried this didn't work
echo "7 6" | sed 's/\([0-9]*\)/\1/'
But did not help much
why you dont have "$" in your replace string? Is that a typo?
/home-dev/->echo "7,6,8,9" | sed 's/\([0-9][0-9]*\)/$\1/g'
$7,$6,$8,$9
Something like this:
echo "4 5 6 7" | sed 's/[0-9][0-9]*/$&,/g'
Using awk:
echo "4 5 6 7" | awk '{ for(i=1;i<=NF;i++) $i="$"$i} OFS =","'
Thanks the awk did the trick i was so confused , i have to use nawk anyone know why awk some times fails but nawk works ?