unix - Need to remove the extra empty lines from the output of shell script -
i'm trying write code print files taking more min_size (lets 10g) in directory. problem output off below code files irrespective of min_size. getting other details mtime , owner later in code part doesnt work fine, whats wrong here ?
#!/bin/sh if (( $# <3 )); echo "$0 dirname min_size count" exit 1 else dirname="$1"; min_size="$2"; count="$3"; #shift 3 fi tmpfile=$(mktemp /lawdump/pulkit/files.xxxxxx) exec 3> "$tmpfile" find "${dirname}" -type f -print0 2>&1 | grep -v "permission denied" | xargs -0 -i {} echo "{}" > "$tmpfile" in `cat tmpfile` x="`du -ah $i | awk '{print $1}' | grep g | sort -nr -k 1`" size=$(echo $x | sed 's/[a-za-z]*//g') if [ size > $min_size ];then echo $size fi done
note : know can done through find or du need write shell script have email sent out regularly details.
wiki
Comments
Post a Comment