<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Noboru Saito</title>
    <description>The latest articles on DEV Community by Noboru Saito (@noborus).</description>
    <link>https://dev.to/noborus</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F42682%2Ff97ad0cf-8d90-4915-9b3b-d80d4349af23.png</url>
      <title>DEV Community: Noboru Saito</title>
      <link>https://dev.to/noborus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/noborus"/>
    <language>en</language>
    <item>
      <title>View large files and CSV files using ov</title>
      <dc:creator>Noboru Saito</dc:creator>
      <pubDate>Sat, 07 Oct 2023 04:01:12 +0000</pubDate>
      <link>https://dev.to/noborus/view-large-files-and-csv-files-using-ov-ele</link>
      <guid>https://dev.to/noborus/view-large-files-and-csv-files-using-ov-ele</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/noborus/ov"&gt;ov&lt;/a&gt; is a terminal pager.&lt;br&gt;
It supports only UTF-8.&lt;/p&gt;

&lt;p&gt;I introduce it because &lt;code&gt;ov&lt;/code&gt; is also suitable for opening large files as a pager.&lt;/p&gt;

&lt;p&gt;Earlier versions of &lt;code&gt;ov&lt;/code&gt; used to read all files into memory, but since v0.30.0, it uses &lt;code&gt;seek&lt;/code&gt; to read only what it needs.&lt;br&gt;
Therefore, large files and CSV files can now be viewed quickly.&lt;/p&gt;

&lt;p&gt;Not only is it faster to open, but it is also as comfortable as possible to operate after opening.&lt;/p&gt;
&lt;h2&gt;
  
  
  Comparison with &lt;code&gt;less&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;While &lt;code&gt;less&lt;/code&gt; can open even large files quickly, there is still some inactivity time after opening because it reads the entire file when it needs to.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ov&lt;/code&gt; does the same and reads the file in a thread (goroutine) after it is opened, thus not interfering with the operation.&lt;/p&gt;

&lt;p&gt;Below is a comparison of the operation of a 4.6 GB file opened with &lt;code&gt;less&lt;/code&gt; and &lt;code&gt;ov&lt;/code&gt;.&lt;br&gt;
The file is opened with line numbers.&lt;br&gt;
With &lt;code&gt;less&lt;/code&gt; it takes time to calculate the line numbers, but with &lt;code&gt;ov&lt;/code&gt; it moves to the end and then back to the beginning again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bruViK8c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/etk31icr4w66rdw5e7ih.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bruViK8c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/etk31icr4w66rdw5e7ih.gif" alt="large-file" width="640" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although &lt;code&gt;ov&lt;/code&gt; continues to read the file in goroutine when it is opened, it does not actually put the entire contents of the file into memory, but records the number of lines and the location of the file to &lt;code&gt;seek&lt;/code&gt; and then reads it down.&lt;br&gt;
This is done in blocks of 10,000 lines. Since it reads in blocks as it needs to, it uses less memory and can move faster.&lt;/p&gt;
&lt;h3&gt;
  
  
  Limitations
&lt;/h3&gt;

&lt;p&gt;The above &lt;code&gt;ov&lt;/code&gt; behavior requires that the file be &lt;code&gt;seek&lt;/code&gt; able; pipe input and special files that cannot be &lt;code&gt;seek&lt;/code&gt; are loaded into memory and acted upon.&lt;br&gt;
(It is also possible to limit the memory, so that content larger than memory will stop reading in the middle of the file or produce a part of the file that cannot be returned if you go ahead).&lt;br&gt;
Also, &lt;code&gt;ov&lt;/code&gt; can open compressed files without being aware of it, but compressed files behave like piped input because &lt;code&gt;seek&lt;/code&gt; and decompressed bytes do not match.&lt;/p&gt;
&lt;h2&gt;
  
  
  Displaying CSV files
&lt;/h2&gt;

&lt;p&gt;Since &lt;code&gt;ov&lt;/code&gt; has a history of originally adding features to make it convenient for displaying &lt;code&gt;psql&lt;/code&gt;, it is also convenient for displaying &lt;code&gt;CSV&lt;/code&gt; files.&lt;/p&gt;
&lt;h3&gt;
  
  
  Fixed header display
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ov&lt;/code&gt; allows fixed display of headers.&lt;br&gt;
The &lt;code&gt;--header&lt;/code&gt; option displays a fixed header.&lt;/p&gt;

&lt;p&gt;If the first line in a &lt;code&gt;CSV&lt;/code&gt; file is a header, you can use the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ov &lt;span class="nt"&gt;--header&lt;/span&gt; 1 file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The latest &lt;code&gt;less&lt;/code&gt; can also display fixed headers, but the difference is that &lt;code&gt;ov&lt;/code&gt; supports header wrapping.&lt;/p&gt;

&lt;h3&gt;
  
  
  column mode
&lt;/h3&gt;

&lt;p&gt;In &lt;code&gt;ov&lt;/code&gt;, use &lt;code&gt;--column-delimiter&lt;/code&gt; to specify the delimiter ("," is the default, so CSV can be omitted) and the &lt;code&gt;--column-mode&lt;/code&gt; option to display in column mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ov &lt;span class="nt"&gt;--column-delimiter&lt;/span&gt; &lt;span class="s2"&gt;","&lt;/span&gt; &lt;span class="nt"&gt;--column-mode&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In column mode, columns can be highlighted, making it easier to locate columns in CSV files that are not aligned vertically.&lt;/p&gt;

&lt;p&gt;In addition, &lt;code&gt;--column-rainbow&lt;/code&gt; will display each column in a different color.&lt;br&gt;
These options can be combined as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ov &lt;span class="nt"&gt;--column-delimiter&lt;/span&gt; &lt;span class="s2"&gt;","&lt;/span&gt; &lt;span class="nt"&gt;--column-mode&lt;/span&gt; &lt;span class="nt"&gt;--column-rainbow&lt;/span&gt; file.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UQteZQ0a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pljk9347rhl7yef87u8w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UQteZQ0a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pljk9347rhl7yef87u8w.gif" alt="ov-csv" width="734" height="503"&gt;&lt;/a&gt;&lt;br&gt;
One limitation is that it does not parse as a &lt;code&gt;CSV&lt;/code&gt; file, so columns containing delimiters (",") or newlines will not be displayed correctly.&lt;br&gt;
Conversely, because it does not parse as a &lt;code&gt;CSV&lt;/code&gt;, even large CSV files can be displayed and moved at high speed.&lt;/p&gt;

</description>
      <category>ov</category>
      <category>csv</category>
      <category>pager</category>
      <category>largefile</category>
    </item>
    <item>
      <title>terminal pager ov</title>
      <dc:creator>Noboru Saito</dc:creator>
      <pubDate>Wed, 29 Apr 2020 02:02:39 +0000</pubDate>
      <link>https://dev.to/noborus/terminal-pager-ov-1iem</link>
      <guid>https://dev.to/noborus/terminal-pager-ov-1iem</guid>
      <description>&lt;p&gt;ov is a terminal pager, like less and more.&lt;br&gt;
It's modern and feature-rich.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vWogaON8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-28d89282e0daa1e2496205e2f218a44c755b0dd6536bbadf5ed5a44a7ca54716.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/noborus"&gt;
        noborus
      &lt;/a&gt; / &lt;a href="https://github.com/noborus/ov"&gt;
        ov
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
       Feature rich terminal pager
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
OV - Oviewer&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/noborus/ov/actions"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RATKI2Tm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/noborus/ov/workflows/Go/badge.svg" alt="Actions Status"&gt;&lt;/a&gt;
&lt;a href="https://goreportcard.com/report/github.com/noborus/ov" rel="nofollow"&gt;&lt;img src="https://camo.githubusercontent.com/69246b538d3b61c55703ea76eff0fc86eefb105f/68747470733a2f2f676f7265706f7274636172642e636f6d2f62616467652f6769746875622e636f6d2f6e6f626f7275732f6f76" alt="Go Report Card"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;ov is a feature rich terminal pager.&lt;/p&gt;
&lt;p&gt;(The old repository name was oviewer.)&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://raw.githubusercontent.com/noborus/ov/master/docs/ov.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pmAqfOAv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://raw.githubusercontent.com/noborus/ov/master/docs/ov.png" alt="ov.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
feature&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Better support for unicode and wide width.&lt;/li&gt;
&lt;li&gt;Support for compressed files (gzip, bzip2, zstd, lz4, xz).&lt;/li&gt;
&lt;li&gt;Supports column mode.&lt;/li&gt;
&lt;li&gt;Header rows can be fixed.&lt;/li&gt;
&lt;li&gt;Dynamic wrap / nowrap switchable.&lt;/li&gt;
&lt;li&gt;Background color to alternate rows.&lt;/li&gt;
&lt;li&gt;Columns can be selected with separators.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
install&lt;/h2&gt;
&lt;h3&gt;
deb package&lt;/h3&gt;
&lt;p&gt;You can download the package from &lt;a href="https://github.com/noborus/ov/releases"&gt;releases&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;curl -L -O https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x-1_amd64.deb&lt;/span&gt;
&lt;span class="pl-c1"&gt;sudo dpkg -i ov_x.x.x-1_amd64.deb&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
rpm package&lt;/h3&gt;
&lt;p&gt;You can download the package from &lt;a href="https://github.com/noborus/ov/releases"&gt;releases&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;sudo rpm -ivh https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x-1_amd64.rpm&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
homebrew(macOS or Linux)&lt;/h3&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;brew install noborus/tap/ov&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
binary&lt;/h3&gt;
&lt;p&gt;You can download the binary from &lt;a href="https://github.com/noborus/ov/releases"&gt;releases&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;curl -L -O https://github.com/noborus/ov/releases/download/vx.x.x/ov_x.x.x_linux_amd64.zip&lt;/span&gt;
&lt;span class="pl-c1"&gt;unzip ov_x.x.x_linux_amd64.zip&lt;/span&gt;
&lt;span class="pl-c1"&gt;sudo install ov /usr/local/bin&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
go get(simplified version)&lt;/h3&gt;
&lt;p&gt;It will be installed in $GOPATH/bin by the following command.&lt;/p&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;&lt;pre&gt;&lt;span class="pl-c1"&gt;go get -u github.com/noborus/ov&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
go get(details or developer version)&lt;/h3&gt;
&lt;p&gt;First of all, download only with the following command without installing it.&lt;/p&gt;
&lt;div class="highlight highlight-text-shell-session"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;go&lt;/span&gt;&lt;/pre&gt;…&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/noborus/ov"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;You can download it from &lt;a href="https://github.com/noborus/ov"&gt;github&lt;/a&gt;. Various packages are also available.&lt;/p&gt;

&lt;p&gt;ov operates as a simple pager.&lt;br&gt;
It has the following features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direct viewing of various compressed files&lt;/li&gt;
&lt;li&gt;Supports UTF-8 emoji and combining characters.&lt;/li&gt;
&lt;li&gt;Passes through an escape sequence of colors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ov is already available in place of &lt;code&gt;less&lt;/code&gt; in many cases (except for man pager).&lt;/p&gt;

&lt;p&gt;And the following functions can be enabled by option or keystroke&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Headers fixed&lt;/li&gt;
&lt;li&gt;Switch between wrapping and not wrapping lines.&lt;/li&gt;
&lt;li&gt;Alternate background colors for the lines.&lt;/li&gt;
&lt;li&gt;Highlight the string between delimiters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is useful for displaying tabular data.&lt;br&gt;
And with this feature, you can also conveniently use it as a pager called from &lt;code&gt;psql&lt;/code&gt; or &lt;code&gt;mysql&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JKBDI08r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://raw.githubusercontent.com/noborus/ov/master/docs/ov-column.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JKBDI08r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://raw.githubusercontent.com/noborus/ov/master/docs/ov-column.gif" alt="column mode"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>terminal</category>
      <category>pager</category>
    </item>
  </channel>
</rss>
