Occasional Perl scripter here. Does Go do text processing, regex etc?

Hi. Occasional Perl scripter here. Perl was my first scripting language and I used it mainly to automate alerts and using Perl’s fantastic regex capabilities , scoop out useful text from command line outputs, use Net::SSH2 module in the script that enables the script to remote login into storage arrays and then gather the command outputs (Net::SSH2 is a Perl interface to the libssh2 library. It supports the SSH2 protocol with all of the key exchanges, ciphers, and compression of libssh2. It’s something similar to Python’s Paramiko module that enables ssh connectivity for the script.

Can I do something similar with Go? Does it have the above mentioned capabilities? I understand that I should not think of Go as a “scripting language on steroids”, but with my limited scripting experience, these are the questions that I have come up with as of now.

Sincerely,
pritesh

Sure. There are regexp and ssh packages in the standard library (well, almost standard, for ssh). That said, these operate at a somewhat lower level than you might like if coming from something like expect or what I suspect it looks like in perl. There are expect libraries as well for Go though, Google brings up a couple at least.

2 Likes

Hi Jakob Borg,

Thank you for taking the time to reply. I am just trying to learn Go as I need to learn a language that can be compiled and hence run faster than the usual scripting languages.

Regards,
pritesh

Good choice IMHO. I love Go for the absence of overly complicated language constructs, for fast compilation and execution, for the large standard library, and for other things, all of which make Go great at writing little command-line tools (even though Go’s primary domain is writing large server applications that scale well on multi-CPU-core architectures).

2 Likes

Hi christophberger,

Thanks again for taking time to answer this question too. I was somewhat apprehensive about the response I would get here, but folks seems to be really helpful.

Great to be here. Looking forward to having fun with Go and using it to resolve some automation requirements I have.

Regards,
pritesh

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.