User Tools

Site Tools


pretty_print_csv_data

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pretty_print_csv_data [2021/07/02 19:25] – [in vim] adminpretty_print_csv_data [2023/11/27 05:59] (current) – [bash function] raju
Line 1: Line 1:
-==== bare bones solution ====+==== command line ====
 <code> <code>
  | column -t -s,  | column -t -s,
Line 46: Line 46:
 See also:- https://www.stefaanlippens.net/pretty-csv.html - talks about handling corner cases and other OSes. See also:- https://www.stefaanlippens.net/pretty-csv.html - talks about handling corner cases and other OSes.
  
-==== in vim ==== +==== zsh function ==== 
-Use+(Todo, 2023-11-27): Add instructions to do this in zsh shell 
 + 
 +==== vim ==== 
 +To convert the whole file
 <code> <code>
 :%!column -t :%!column -t
 </code> </code>
-to convert the whole file or+To convert a visual selection
 <code> <code>
 :'<,'>!column -t :'<,'>!column -t
-</code> 
-to convert a visual selection. 
- 
-For example 
-<code> 
-:%!column -t 
 </code> </code>
  
-will convert+Sample input:
 <code> <code>
 1.33570301776, 3.61194e-06, 7.24503e-06, -9.91572e-06, 1.25098e-05, 0.0102828 1.33570301776, 3.61194e-06, 7.24503e-06, -9.91572e-06, 1.25098e-05, 0.0102828
Line 69: Line 66:
 </code> </code>
  
-to+Sample output:
 <code> <code>
 1.33570301776,  3.61194e-06,   7.24503e-06,  -9.91572e-06,  1.25098e-05,  0.0102828 1.33570301776,  3.61194e-06,   7.24503e-06,  -9.91572e-06,  1.25098e-05,  0.0102828
Line 76: Line 73:
 </code> </code>
  
-Ref:- https://stackoverflow.com/questions/1229900/reformat-in-vim-for-a-nice-column-layout+Ref:- https://stackoverflow.com/questions/1229900/reformat-in-vim-for-a-nice-column-layout - contains some tips on how to handle cases where there are delimiters inside string literals.
pretty_print_csv_data.1625253942.txt.gz · Last modified: 2021/07/02 19:25 by admin