Yesterday I was faced with a 21 megabyte text file that needed several find/replace operations. Tex-Edit would open the file, but not change it. BBEdit would chug through the changes, but it was taking forever. I dropped into a Terminal window and used:
perl -pi -e 's/find/replace/g' filename
However, this too was slow -- much slower than I expected.
Because I was checking the file in Tex-Edit after each find/replace, the process was taking some time, until on a whim I used Tex-Edit to change the line endings from "Mac" to "Unix" style.
From that point on, the 'perl s/' command ran blazingly fast.
The upgrade to 10.1.3 also included OpenSSH 3.0.2p1.
I found out that there is a change in how authentication with other servers is handled in this version. When I connect to one of my OpenBSD boxen, I get asked for my S/key password before I have a chance to enter my normal password. That's of course very unfortunate if you have not set up your s/key passwords, or do not carry them with you.
The fix was for me to add one line to the /etc/ssh_config file:
tc is yet-another-calculator. This time written in tcl, and it's very easy to personalize. It has a few symbols showing the ways you can customize it. With this script (I put it in ~/bin/tc; chmod +x and rehash), you can write arithmetic expressions in a natural way, avoiding the use of the * and () signs that are preinterpreted by the shells. It is also very easy to add symbols that are replaced before the expression is evaluated. I use it also as a euroconverter, showing how easy it is to expand its behaviour. For example:
% tc sin 3 eu sin(3) * 166.386 = 23.480393661 % tc 2 2 2 * 2 = 4 % tc 2 x 2 2 * 2 = 4
This falls into a "nitpicky" category. As someone who enjoys the extreme customization ability of X11's (e.g. XFree86) ATerm program, but hates the holdbacks that go along with using X11, I am always looking for ways to make Terminal behave more like ATerm.
One of the things I like to do is to see a couple of my log files all of the time. With ATerm, I can make a 100x8 character window, remove the scroolbars, titlebar, and resize handles, turn it 60% transparent, and put it in a corner. Good stuff.
In Terminal, you can't get quite that handy, but you can get close. Read the rest of the article for some settings to make "utility" terminal windows less intrusive...
While visiting a friend the other night, he showed me a trick in the terminal that I hadn't seen before, and I'm pretty sure hasn't been mentioned here as of yet. I'm also not sure of the usefulness of this trick, but it is interesting.
You can work with the resource fork for any file by simply adding "/rsrc" to the end of some file handling commands. For example, you could use this method to see which files within a directory contain resource forks:
All i wanted was a simple biff program for the dock, just a little, unobstrusive, audio/visual "new mail" signal, so that i wouldn't keep popping open my mutt window every N minutes (bad discipline). No such luck and too lazy to write something myself (and afraid of SOMEHOW managing to screw something up and lose mail). Here's what i ended up doing.
Read the rest of the article for the how-to. This hint assumes you have mutt and esound installed ... check out fink first if you don't...
[Editor's note: This tip also assumes the Dev Tools are installed and you have some knowledge of compiling UNIX software. I have not tried it myself, since I'm pretty happy with Mail.app]
Most modern computers offer a feature called "Wake on LAN". This is designed to allow a network administrator to turn on a computer remotely, even when it is turned off, by sending a "magic packet". This is used, for instance, to allow backup programs to run at night.
I haven't found any trace of this documented on Apple's web site, but it seems Macs also implement this feature (at least my iMac G4 does). I use this feature to turn on my iMac from my office when I want to log on using ssh (I have a Solaris machine on my home LAN that runs 24/7).
The magic packet format is very simple: it must include anywhere in the packet 6 times hexadecimal FF, followed by 16 times the Mac's MAC address (pun intended). The easiest way to do this is to send a broadcast.
Here is a Python script that does this (if your MAC address is 01-23-45-67-89-0a:
[Editor's note: Sounds very cool, but I don't run Python ... any way to replicate this script in something that's installed on all OS X boxes? I know there are a lot of people that would probably be interested in such a solution, myself included!]
For those of us who prefer to edit (or at least fine-tune) a webpage in a good old-fashioned text editor, iTools has made it pretty easy. If you have .html files in your Sites folder on iTools, you can simply open a terminal window and edit those files. They are located in
where iToolsName is replaced with your iTools username.
Use vi or emacs or pico to edit whatever files you choose and save. The changes are instantaneous because you are editing the source right out. You can even create new files this way.