I often handle csv in my work. There seems to be a csv viewer in CUI, so I will put it in
https://github.com/wfxr/csview
#download
$ curl -OL https://github.com/wfxr/csview/releases/download/v0.3.5/csview-v0.3.5-x86_64-unknown-linux-gnu.tar.gz
#Defrost
$ tar -zxvf csview-v0.3.5-x86_64-unknown-linux-gnu.tar.gz
$ cd csview-v0.3.5-x86_64-unknown-linux-gnu
#Move to where the pass passes
$ sudo mv csview /usr/local/bin/
It's easy.
Then practice!
#Run
$ csview a.csv
Then
$ sudo yum update glibc
I will try to update with, but it seems that there is only up to 2.17.
Then
https://omohikane.com/deno_not_found_glibc_218/
It seems that you can manually update glibc by referring to the article in, so I will try it.
$ cd /tmp
$ wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz
$ tar -zxvf glibc-2.18.tar.gz
$ cd glibc-2.18
$ mkdir build
$ cd build
$ ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
$ make && make install
$ ldd --version
ldd (GNU libc) 2.18
Copyright (C) 2013 Free Software Foundation, Inc.
The glibc is now 2.18. .. It was good.
Regain your mind and practice csview again!
$ csview a.csv
[error] input is not utf8 encoded
Another error. It is useless if the character code is not utf8.
You can go by biting iconv as described in the README of github of csview.
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview
+-------------+----------+----------------+
|code|name|Description|
+-------------+----------+----------------+
| abc |eraser|It disappears often|
| ABCDEFGHIJK |Pencil|Easy to hold|
| | |The core is also hard to break|
+-------------+----------+----------------+
I was able to go! !! !! !! : clap:
$ ./csview --help
csview 0.3.5
A high performance csv viewer with cjk/emoji support.
USAGE:
csview [FLAGS] [OPTIONS] [FILE] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-H, --no-headers Specify that the input has no header row
-t, --tsv Use '\t' as delimiter for tsv, overrides '-d' option
-V, --version Prints version information
OPTIONS:
--style <border> Specify the border style [default: Ascii] [possible values: None, Ascii, Sharp, Rounded, Reinforced, Markdown, Grid]
-d, --delimiter <delimiter> Specify the field delimiter [default: ,]
ARGS:
<FILE> File to read
SUBCOMMANDS:
completion Generate shell completion file
help Prints this message or the help of the given subcommand(s)
So, it seems that you can change it with --style
.
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style none
Code name Description
abc eraser It erases well
ABCDEFGHIJK It's easy to hold a pencil
The core is also hard to break
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style ascii
+-------------+----------+----------------+
|code|name|Description|
+-------------+----------+----------------+
| abc |eraser|It disappears often|
| ABCDEFGHIJK |Pencil|Easy to hold|
| | |The core is also hard to break|
+-------------+----------+----------------+
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style sharp
┌─────────────┬──────────┬────────────────┐
│ Code │ Name │ Description │
├─────────────┼──────────┼────────────────┤
│ abc │ Eraser │ It disappears well │
│ ABCDEFGHIJK │ Pencil │ Easy to hold │
│ │ │ The core is also hard to break │
└─────────────┴──────────┴────────────────┘
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style rounded
╭─────────────┬──────────┬────────────────╮
│ Code │ Name │ Description │
├─────────────┼──────────┼────────────────┤
│ abc │ Eraser │ It disappears well │
│ ABCDEFGHIJK │ Pencil │ Easy to hold │
│ │ │ The core is also hard to break │
╰─────────────┴──────────┴────────────────╯
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style reinforced
┏─────────────┬──────────┬────────────────┓
│ Code │ Name │ Description │
├─────────────┼──────────┼────────────────┤
│ abc │ Eraser │ It disappears well │
│ ABCDEFGHIJK │ Pencil │ Easy to hold │
│ │ │ The core is also hard to break │
┗─────────────┴──────────┴────────────────┛
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style markdown
|code|name|Description|
|-------------|----------|----------------|
| abc |eraser|It disappears often|
| ABCDEFGHIJK |Pencil|Easy to hold|
| | |The core is also hard to break|
$ iconv -f shift-jis -t UTF8//TRANSLIT a.csv| csview --style grid
┌─────────────┬──────────┬────────────────┐
│ Code │ Name │ Description │
├─────────────┼──────────┼────────────────┤
│ abc │ Eraser │ It disappears well │
├─────────────┼──────────┼────────────────┤
│ ABCDEFGHIJK │ Pencil │ Easy to hold │
│ │ │ The core is also hard to break │
└─────────────┴──────────┴────────────────┘
I usually handle csv where line breaks are often done, so personally grid is the best.
It is troublesome to specify iconv every time, so I will prepare an alias (function).
Since it is a conversion to shift-jis, I changed it to csviews
with csview
+ s
. ..
By the way, I will also put the style of the display
function csviews() {
command iconv -f shift-jis -t UTF8//TRANSLIT $1 | csview --style grid
}
$ csviews a.csv
┌─────────────┬──────────┬────────────────┐
│ Code │ Name │ Description │
├─────────────┼──────────┼────────────────┤
│ abc │ Eraser │ It disappears well │
├─────────────┼──────────┼────────────────┤
│ ABCDEFGHIJK │ Pencil │ Easy to hold │
│ │ │ The core is also hard to break │
└─────────────┴──────────┴────────────────┘
Ah convenient.
It seems to be difficult when looking at big things, but when it is troublesome to open it with software with a little confirmation ... It seems very convenient.
On qiita, the lines are separated because the padding between the lines is effective, but on the actual console, the lines are neatly attached and drawn. If you are interested, please give it a try.
Recommended Posts