Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal eno2001's Journal: UNIX: Yet Another Stupid SSH Trick 4

Yay!!! I get post yet another incredibly useful way of using ssh for something that most people would think was "stupid".

THE SCENARIO:
You're on a box with a much older version of NIX on it than you should be. In the middle of doing your work, you find the certain utilities are missing, or are old enough that they have some key features missing. What do you do? Tell your boss the box sucks, get a new one. Wipe the box and all the important data you're supposed to be working on with a new installation of some free *nix? Give up?

THE SOLUTION:
In most cases, if you're working on a box like this, it's likely that your dealing with text. That was what I was dealing with and the version of egrep was too old to parse the following:

egrep '(cn:|inetUserStatus:|mailUserStatus:)'

So what did I do? I took advantage of the newer egrep on my Linux workstation using ssh:

/opt/iplanet/server5/shared/bin/ldapsearch -D "cn=King of all Mail" -w iam1337d00dzg1v3m3w4r3z -b "o=peons.org, o=werule.org" "uid=*" | ssh eno2001@10.0.2.20 "egrep '(cn:|inetUserStatus:|mailUserStatus:)' -" | less

The end result is that the text stream from the old *nix box is sent via ssh to my workstation where I run the egrep using STDIO. Works like a charm! Hope this helps someone else.

This discussion has been archived. No new comments can be posted.

UNIX: Yet Another Stupid SSH Trick

Comments Filter:
  • I thought that was rather brilliant. +5 Coolness :D
    • by eno2001 ( 527078 )
      Heh. Thanks. It's yet another "tape and chewing gum" approach. But it works very well. :)
  • You have my pity :-)
    • by eno2001 ( 527078 )
      Now you see why I'm so busy lately. As much as I've tried to automate this migration of LDAP data from one system to another better, but incompatible system, I'm still having to hand edit a lot of LDIF files... There's some stuff automation won't do when you have unique elements in your data that need to be parsed by human eyes. I suppose if I were a real programmer, I'd be able to do this a little easier...

All the simple programs have been written.

Working...