VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Example: Save Selected Text To CSV File (https://forums.vandyke.com/showthread.php?t=12337)

jdev 04-25-2016 05:13 PM

Example: Save Selected Text To CSV File
 
1 Attachment(s)
You may have a scenario where there are columns of data (space-separated) on the screen, and you want to get that data into a CSV file for work in Excel. This script shows how you can take space-delimited columns of text selected in SecureCRT's terminal screen and save it to a CSV file, converting the spaces to commas.

One suggestion would be to map this script to a Run Script button on SecureCRT's button bar. Then, whenever needed, simply select the data & then press the button to run the script to save the selected data to a CSV file for you, prompting you for the filename (filling in a sensible default), and then automatically bringing up the CSV file for view in the default system app.

Remember that holding down the Alt key while selecting text allows you to select in "Column Mode", so that you can even eliminate unwanted columns prior to having the data saved, if you only want a subset of the columns saved to the CSV file.

--Jake


All times are GMT -6. The time now is 01:10 AM.