Advertisement
metalx1000

View CSV files in the Shell

Jun 26th, 2024
971
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. wget -qO- "https://randomuser.me/api/?nat=us&results=100&format=csv"  > users.csv
  2.  
  3. cat users.csv
  4.  
  5. #no line wrap and searchable
  6. less -S users.csv
  7.  
  8. #better spacing
  9. column -t -s, users.csv   #looks messy because of line wrapping
  10. column -t -s, users.csv|less -S
  11.  
  12. #if using delimiters other then comas
  13. sed 's/,/|/g' users.csv > users2.csv
  14. column -t -s\| users2.csv|less -S
  15.  
  16. #using vim/neovim
  17. vim <(column -t -s, users.csv)
  18.  
  19. # might give you more options
  20. sudo apt-get install csvtool
  21. csvtool readable users.csv
  22. csvtool readable users.csv|less -S
  23. csvtool readable users.csv|view     #vi read only
  24. vim <(csvtool readable users.csv)
  25.  
  26. #and of course visidata
  27. sudo apt install visidata
  28. visidata users.csv
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement