I would like to customize the output from:
du -hs *
E.g output:
23G Test1
1.2M Folder With Spaces
12G Another Folder With Spaces
The problem is that I can capture the first column but since the second column may contain spaces the output only captures the first word. Is there a way to capture the second column spaces included or perhaps return the remaining content for that line?
du -hs * | awk '{print $1 " " $2;}'
The above returns this:
23G Test1
1.2M Folder
12G Another
EDIT: The Solution is to add the -F and specify the tab delimiter:
du -hs * | awk -F'\t' '{print $1 " " $2;}'
Tabs are also valid characters in files/folders. In my case this would never be an issue.