Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Capture command line output directly to a text file' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Capture command line output directly to a text file
Authored by: mario_grgic on Jul 29, '08 04:42:36PM

Well, you can't call yourself a UNIX geek if you don't know how to re-direct std out (or error stream) to a file or device. Eg.

find / -name "*.txt" 2>/dev/null > list.lst

finds all files with .txt extension and puts the list to list.lst in current directory, and the error stream (e.g. you don't have a permission to list the directory or file) is sent to /dev/null (i.e. thrown away).

If you use (a real editor) vi/vim you can read from std out stream directly as in

ls / | vim -

which lists all files on your file system you are allowed to see and pipes them to vim which reads it from the stream.



[ Reply to This | # ]
Capture command line output directly to a text file
Authored by: tom larkin on Jul 29, '08 05:39:49PM

I use a different option but here it is

cat /path/to/file | open -f -a "textwrangler.app"



[ Reply to This | # ]