Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Thursday, June 28, 2018

Check du disk usage by file types on Linux

#!/bin/bash

for ext in `find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u`; do
    echo "`find . -name "*."$ext -print0 | du -ch --files0-from=- | tail -1` by "$ext
done

Tuesday, April 22, 2008

extract the last field in unix shell script

scratch notes on aws exacting the last field!
echo “ABC.123.QIP.ERR” | awk -F. {’print $(NF-0)’}

- dot after F is the field deliminator
- minus zero is the field to extract from backwards of the string