0

I have du -sh output saved to txt file:

2.1G /home/x/sample/2GB/ 101M /home/x/sample/100MB/ ... 

What I want is to multiply each value in the first column by a value taken from variable depending on the unit. So if for instance unit is G then multiply by $G and append the the result at the end of each line. How to do this in Bash?

1 Answer 1

0

It sounds like you're trying to get the bytes, so instead of using -h (which is a shortcut for --human-readable), just don't use it.

du -s will get you the summarized byte count.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.