How do I truncate output in BASH?
For example, if I ‘du file.name’ how do I just get the numeric value and nothing more?
later addition:
all solutions work perfectly. I chose to accept the most enlightning ‘cut’ answer because I prefer the simplest approach in bash files others are supposed to be able to read.
If you know what the delimiters are then cut is your friend
Cut defaults to tab delimiters so in this case you are selecting the first field.
You can change delimiters: cut -d ‘ ‘ would use a space as a delimiter. (from Tomalak)
You can also select individual character positions or ranges: