I have some categories and their values:
Category: Value: 1*4 15.934934 1*5*3 19.281281 1*8*10*2 78.20912
I would like to replace the categories by numbers that represent the categories.
For example:
1*4 has two numbers then it would be replaced by 2
1*5*3 has three numbers then it would be replaced by 3
1*8*10*2 has four numbers then it would be replaced by 4
I need to do the process for hundreds of files so it is very important to automate the process!
sed
? there's a straightforward way inawk
for examplegsub
of sequences of digits in$1
and assign the result (number of successful substitutions) back to$1
i.e.$1 = gsub(/[0-9]+/,"",$1)