Tuesday, August 24, 2010

Find with grep displaying line number & filename

( find . -exec grep -H -n 'blahblahpattern' {} \; )

Tuesday, August 4, 2009

Using Grep to return only the match, getting unique/distinct results, and sorting

Display only the matches (in this case, occurrences of 6 numbers in a row)

grep -o "[0-9]\{6\}" test.txt

Removing repeated results, and sorting

grep -o "[0-9]\{6\}" test.txt | uniq | sort

Woo.

Friday, February 13, 2009

GDB, first use

Thanks to humph.
Find the process id you're looking for:

ps aux | grep appname

Now we have the Process ID, and the path to the app.

gdb /path/to/your/app -p pidForApp

Press enter alot. The app is now frozen. Type c then press enter to continue. Hit CTRL+C to lock it again.
b somefile.cpp:567 to set a break point.

Thursday, January 29, 2009

Notes on a Choob Bot

On irc://moznet/ the nick Sugnim is a choob bot. The search command, where it responds to messages of search blah (eg. /msg Sugnim search blah or !search blah in a channel Sugnim occupies), will show the Bugzilla corresponding bug.
Choob code:
http://svn.uwcs.co.uk/repos/choob/
Code for that choob extension:
http://trac.uwcs.co.uk/choob/browser/trunk/contrib/BugzillaBugmail.js
Note that this isn't Sugnim's code. Silver has fixed so HTML entities are resolved, via find and replace (JS doesn't have an inbuilt escape/unescape HTML function), which isn't committed code yet.