Tugger the SLUGger!SLUG Mailing List Archives

Re: [chat] you are in a maze of twisty little header files, all alike...


On Wed, 2 Jul 2003, Benno wrote:

> FWIW:
> 
> #!/usr/bin/python
> import os, sys
> print os.strerror(int(sys.argv[1]))
> 
> Benno-waiting-to-see-it-in-sed

Ask and ye shall receive... Not quite as general purpose, but still...

$ VAL=113
$ sed -e '/[	 ]'$VAL'	/!d' -e 's|^.*/\* \(.*\) \*/.*$|\1|' \
/usr/include/asm/errno.h

Just change the number in the variable to change the errno you find.  You
could also wrap it in a shell script and do the var sub in there, but that'd
kill the fun.

Note also that the whitespaces in the delete command are a mix of tabs and
spaces - a tab and a space in the brackets, and a tab after $VAL.


-- 
-----------------------------------------------------------------------
#include <disclaimer.h>
Matthew Palmer, Geek In Residence
http://ieee.uow.edu.au/~mjp16