bash - How to sort all csv files in a directory -
i have directory csv files inside . example:
dir a->dir1->.csv dir2->.csv wish sort of csv file according 4 column how go threw of directories inside dir a.
thank you
i understood, that want csv files under specific directory sorted based on 4th column,
you looking word recursively,
i assume csv files below, trying sort based on 4th column
1,apple,red,2765 2,mango,green,100 3,pineapple,yellow,900
if csv files parent directory "/home/think/csvs", try below,
# setting path of parent directory path="/home/think/csvs" # finding .csv files under path in `find $path -type f -name '*.csv'` # sorting based on 4th columns(k4) using comma(,) field separator sort -t"," -k4 $i done
not tested, going this.
Comments
Post a Comment