I am struggling with figuring out a way to sum up a row of numbers.
I have the following code.
lshw -class disk -class storage | grep size: | cut -d "(" -f2 | cut -d ")" -f1
This gives me the result
2TB 2TB 2TB 2TB 2TB 2TB
On my other machine:
500GB 1TB 1TB
Is there a way to sum these up? I need to keep GB or TB
im totally fine it being said in GB's or a way that it only add these up if there are more than 2 results? I have multiple machines where i am supposed to run this command. Some of them have 5 Hard Drives in them, some have only 1.