to paste terminal data in ubuntu into csv

There is no simple facility for scrolling back and selecting parts of the output you already received (though of course, if you like, you can select something with the mouse and copy/paste into an editor and save it from there), but if you can run the same command again and get the same results, run it again and redirect to a file, perhaps with simple postprocessing.

some-command -with arguments -and -options >output.txt

The result you shows looks like tab-separated data, which is already basically CSV, only with tabs instead of comma (TSV). If there are no other commas in the data, tr '\t' ',' will change all the tabs into commas, yielding a CSV file.

some-command -with arguments -and -options | tr '\t' ',' >output.csv

In more complex cases, you may need to use various standard Unix utilities to perform more elaborate postprocessing tasks. Make sure you are familiar with the basic tools (tr, cut, paste, etc) as well as at least the basics of the standard scripting languages sed and Awk.

Ultimately, you might want to familiarize yourself with a modern scripting language like Python, which has a well-documented csv module as part of its standard library, and a fairly relaxed learning curve.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top