this script lists unit-*-slides.txt files in directory filelist.txt file , file list goes file , reads file , gives count of st^ lines file.but not counting in order ex 1,2,3,4,.... counting 10,1,2,3,4......
how read in order.
#!/bin/sh # outputdir=filelist mk=$(mkdir $outputdir) $mk dest=$outputdir cfile=filelist.txt ofile="combine-slide.txt" output=file-list.txt path=/home/user/desktop/script ls $path/unit-*-slides.txt | sort -n -t '-' -k 2 > $dest/$cfile echo "generating files list..." echo "done" #combining while ifs= read file if [ -f "$file" ]; tabs=$(cat unit-*-slides.txt | grep "st^" | split -l 200) fi done < "$dest/$cfile" echo "combining done........!"
try sort -n
tabs=$(cat $( ls unit-*-slides.txt | sort -n ) | grep "st^" | split -l 200)
sort -n
means numeric sort, output of ls
ordered number.
Comments
Post a Comment