declare sep noheader;
sep='\t';
noheader=0;
+ declare files=''
+
while [ $# -gt 0 ]; do
- case "$1" in
- --sep|-s)
- sep=$2;
- shift
- ;;
- --noheader|-nh)
- noheader=1
- ;;
- *)
- echo "Unknow option: $1 at $0!";
- return -1
- ;;
- esac;
- shift;
- done;
+
+ if [ -e "$1" ]; then
+ files="$files $1"
+ shift
+ continue
+ fi
+
+ case "$1" in
+ --sep|-s)
+ sep=$2;
+ shift
+ ;;
+ --noheader|-nh)
+ noheader=1
+ ;;
+ *)
+ echo "Unknow option: $1 at $0!";
+ return 1
+ ;;
+
+ esac
+
+ shift
+
+ done
+
[ -z "$@" ] || sep="$@";
- cat | perl -MEncode -F"$sep" -ane 'BEGIN {
+
+ cat $files | perl -MEncode -F"$sep" -ane 'BEGIN {
$noheader = shift @ARGV;
@len = (); @lines = ();
binmode( STDOUT, "utf8:" );