Pages

Monday, August 19, 2019

show csv files by pspg pager

Long time I am thinking about support CSV format inside pspg. Still I have some other task, and I have not a quite time for this job. But I found nice application miller, that can be used for formatting CSV to MySQL tables format, and this format is supported by pspg already.

Data:
id,okres_id,nazev,pocet_muzu,pocet_zen,vek_muzu,vek_zen
1,CZ0100,Praha,608316,640710,39.8,43.2
2,CZ0201,Benešov,7875,8507,39.2,41.9
3,CZ0201,Bernartice,108,115,45.9,43.3
4,CZ0201,Bílkovice,93,89,41.4,46.8
5,CZ0201,Blažejovice,52,48,44.6,50.8
6,CZ0201,Borovnice,39,37,45.6,49.5
7,CZ0201,Bukovany,364,372,38.1,38.8
8,CZ0201,Bystřice,2124,2096,38.5,41.1
9,CZ0201,Ctiboř,55,50,38.6,42.0

Command:
mlr --icsv --opprint --barred put '' obce.csv | pspg --force-uniborder

Result:

Itegration with mc
  1. copy file from mc.ext from /etc/mc to ~/.config/mc directory
  2. append
    #csv
    regex/\.csv
        View=mlr --icsv --opprint --barred put '' %f | pspg --force-uniborder
  3. restart mc
     

No comments:

Post a Comment