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
Last revisionBoth sides next revision
pretty_print_csv_data [2021/07/02 19:24] – [bash function] adminpretty_print_csv_data [2021/07/02 19:42] admin
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 ==== +==== vim ==== 
-Use+To convert the whole file
 <code> <code>
 :%!column -t :%!column -t
 </code> </code>
-or+To convert a visual selection
 <code> <code>
 :'<,'>!column -t :'<,'>!column -t
 </code> </code>
-to convert the whole file or a visual selection using 
-respectively. 
  
-For example +Sample input:
-<code> +
-:%!column -t +
-</code> +
- +
-will convert+
 <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 70: Line 63:
 </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 77: Line 70:
 </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.txt · Last modified: 2023/11/27 05:59 by raju