Skip to main content
added 2 characters in body
Source Link
aborruso
  • 3k
  • 14
  • 31

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat inputFile | \
mlr --opprintocsv --quote-none  --icsvlite stats1 -g '"1"' -a min,max,min -f '"2","3"'"3","4"' \
then cut -f '"1","2"_min,"3"_max'"3"_max,"4"_min' \
then label id,col2,col3,col4 | sed 's/"//g'

you have

id        ,col2     ,col3,col4
"0164318" "001449" "001457"0164318,001449,001457,001922
"0842179" "002115" "002118"0842179,002115,002118,001485
"0846354" "001512" "001513"0846354,001512,001513,001590
"0841422" "001221" "001228"0841422,001221,001228,001860

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat inputFile | \
mlr --opprint --icsvlite stats1 -g '"1"' -a min,max -f '"2","3"' \
then cut -f '"1","2"_min,"3"_max' \
then label id,col2,col3

you have

id        col2     col3
"0164318" "001449" "001457"
"0842179" "002115" "002118"
"0846354" "001512" "001513"
"0841422" "001221" "001228"

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat inputFile | \
mlr --ocsv --quote-none  --icsvlite stats1 -g '"1"' -a min,max,min -f '"2","3","4"' \
then cut -f '"1","2"_min,"3"_max,"4"_min' \
then label id,col2,col3,col4 | sed 's/"//g'

you have

id,col2,col3,col4
0164318,001449,001457,001922
0842179,002115,002118,001485
0846354,001512,001513,001590
0841422,001221,001228,001860
added 2 characters in body
Source Link
aborruso
  • 3k
  • 14
  • 31

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat a22.txtinputFile | \
mlr --opprint --icsvlite stats1 -g '"1"' -a min,max -f '"2","3"' \
then cut -f '"1","2"_min,"3"_max' \
then label id,col2,col3

you have

id        col2     col3
"0164318" "001449" "001457"
"0842179" "002115" "002118"
"0846354" "001512" "001513"
"0841422" "001221" "001228"

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat a22.txt | \
mlr --opprint --icsvlite stats1 -g '"1"' -a min,max -f '"2","3"' \
then cut -f '"1","2"_min,"3"_max' \
then label id,col2,col3

you have

id        col2     col3
"0164318" "001449" "001457"
"0842179" "002115" "002118"
"0846354" "001512" "001513"
"0841422" "001221" "001228"

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat inputFile | \
mlr --opprint --icsvlite stats1 -g '"1"' -a min,max -f '"2","3"' \
then cut -f '"1","2"_min,"3"_max' \
then label id,col2,col3

you have

id        col2     col3
"0164318" "001449" "001457"
"0842179" "002115" "002118"
"0846354" "001512" "001513"
"0841422" "001221" "001228"
Source Link
aborruso
  • 3k
  • 14
  • 31

With Miller (http://johnkerl.org/miller/doc), using

mlr --ocsv --quote-all --inidx --ifs , cat a22.txt | \
mlr --opprint --icsvlite stats1 -g '"1"' -a min,max -f '"2","3"' \
then cut -f '"1","2"_min,"3"_max' \
then label id,col2,col3

you have

id        col2     col3
"0164318" "001449" "001457"
"0842179" "002115" "002118"
"0846354" "001512" "001513"
"0841422" "001221" "001228"