New to Scripting

Hello and thank you in advance
I would like to create a script that executes a command from a remote server and automatically creates a file with the output and moves it to the source server running the command. Is this possible?

ssh username@host command > localfile
1 Like

thank you for the quick reply one more question once i have the file can I automatically format it to say a csv file for excel or post it to a web page?

That is a big and vague enough question one can't really answer it without seeing the information you have and the information you want. There's not a general purpose "make any random text look pretty and tabular" command.

of course understood the data looks like this

PDId CagePos Type Speed(K) VVId VVName Adm Snp Usr Total
8 0:2:0 NL 7 40 lun-db.tpvv.10 0 0 191 191

And what do you want it to look like?

To make it a CSV, replace spaces with commas and add carriage returns, I suppse.

command | sed 's/ /,/g;s/$/\r/' > outputfile
1 Like

this is perfect thank you!!!