Standard Input piped to a text editor

If you have BBEdit and you have installed the command line tool you have a real nice resource for printing lists of file directories. Even without the command line you can drag a directory into a BBEdit window and create a file list of that directory. With the command line tool you can pipe standard input into it.

ls -l | bbedit

will open a BBEdit window with the list. Now if you want to print all the files in subfolders below the current directory, type:

ls -R | bbedit.

That will create a real nice list of all the files and subdirectories with their files.

If you don’t have BBEdit, you can still use one of the free command line text editors. To use vi type:

ls -R | vi -

The “-” flag is to tell vi to use standard input instead of a file name to open. If you want to print this you can do it with a :w !lpr command. Of course your printer has to be set up to use lpr. If you are running Panther with cups chances are your printer is set up to use lpr.

One Response to “Standard Input piped to a text editor”

  1. Danal Says:

    This information was really helpful. Since I already have BBEdit, I tried it, & it works like a charm!