[ "$cron" != "$(crontab -l)" ] && crontab <<< "$cron"
}
+
+csv2human() {
+ shell_help "Usage: $FUNCNAME [PERL_REGEXP --sep|-s (default: tab)] [--noheader|-nh]" "$@" && return;
+ declare sep noheader;
+ sep='\t';
+ noheader=0;
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ --sep|-s)
+ sep=$2;
+ shift
+ ;;
+ --noheader|-nh)
+ noheader=1
+ ;;
+ *)
+ echo "Unknow option: $1 at $0!";
+ exit -1
+ ;;
+ esac;
+ shift;
+ done;
+ [ -z "$@" ] || sep="$@";
+ cat | perl -MEncode -F"$sep" -ane 'BEGIN {
+ $noheader = shift @ARGV;
+ @len = (); @lines = ();
+ binmode( STDOUT, "utf8:" );
+};
+for ($i=0;$i<@F;$i++) {
+ chomp($F[$i]);
+ $F[$i] = Encode::decode_utf8($F[$i]);
+ $len[$i] = $l if ( $l = length($F[$i])) >= $len[$i];
+}
+push @lines, [@F];
+END {
+ exit unless @lines;
+ $i = 0;
+ $t = -1;
+ $format = "| ".join(" | ",map {$t+=$_+3; "\%-".$_."s"} @len)." |".chr(10);
+ $sep_line = "+".join("+",map {("-"x($_+2))} @len)."+".chr(10);
+ print $sep_line;
+ while ($_ = shift @lines) {
+ printf $format,@$_;
+ print $sep_line if !$noheader and !$i++;
+ }
+ print $sep_line;
+}
+' $noheader
+}