0

I have a Python script gathering info from some remote network devices. The output can be maybe 20 to 1000 lines of text. This then goes into excel on my local PC for now.

Now access to this Linux device is convoluted, a citrix session to a remote windows server then ssh to the Linux device half way around the world. There is no ftp, scp, or anything like that, so I can't generate the excel on the Linux device and transfer it locally. The ONLY way to get the info is to copy/paste from the ssh window into the local machine and post-process it

My question is what would be the best (from a user point of view as others will be using it) format to generate? 1.as it is now (spaces & tabs), 2.reformat as csv or as 3.convert to xml

3 Answers 3

7

CSV is more robust than your current format under "copy and paste transfer" -- spaces and tabs can easily get confused, commas and doublequotes aren't. And the Python standard library's csv module makes it pretty easy to solidly generate good CSV output.

Sign up to request clarification or add additional context in comments.

1 Comment

OK Thanks - there's really no advantage of moving to xml, but many advantages of not sticking to tab/space
0

Reformat it as CSV. It's dead easy to do, is fairly human readable, and can be read by loads of pieces of spreadsheet software.

Comments

0

Are you sure copy-paste is the only way? If you can interactively ssh to the Linux device, then you can also ssh plus run a command plus redirect the output. So:

ssh remote-linux-box command-to-run >output-file

This doesn't involve any manual copy and paste at all.

3 Comments

I generate the output on the Linux box locally as you say above. At that point I have the file on the box - only accessible via citrix - and scp/ftp etc are denied. In fact I can't create files on the citrix server
I see what you're saying (especially about not being able to create files on the citrix server, that's an unfortunate restriction). However, note that the redirect in my example above applies to the box on which you run ssh, not to the remote-linux-box. Redirecting on the remote linux box would require quotes around the redirection: ssh remote-linux-box "command-to-run >output-file"
Ah sorry I thought you were meaning on the linux box command > txtfile which is how I do it then cat the file, copy & paste. This is really nailed down. I had to get a guy locally to install pexpect!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.