extracting specific text from lines

Hello,

i've got this output text:

and i need it to look something like this:

which means that there won't be absolute path of each directory, just it's size and the last word after last '/' in each line, and i also don't need last line '1.7M /tmp'

Looks like there is a simple solution for that, but i'm only a beginner to linux, so i'll apreciate any help. :wink:

 
awk -F\/ 'NF>2{print $1,$NF}' infile
1 Like
awk -F'/' '{print $1,$NF}' youroutput
1 Like
awk -F/ 'NF>2{print $1,$NF}' file
1 Like

Try:

sed '$d;s|/.*/||' infile
sed -n 's|/.*/||p' infile
1 Like

Thanks all of you, it works.