Shell scripting notes – searching matching filenames and matching content

Some random shell scripting notes for future reference:

On OS X: find -E . -regex ‘pattern’

  • -E specifies extended regex support

On Linux flavors: find . -regextype posix-regex -regex ‘pattern’

Posix vs basic vs extended regex character class differences.

Pipe result to newfile > : eg grep ‘pattern’ file > output.txt

Pipe result appending to file > : eg grep ‘pattern’ file >> output.txt

Capture output as String? : $(some expression)

Iterate files:

for f in some-file-pattern or something producing a list of files
do ... done

Use find . -name ‘pattern’ to recurse matching files down subdirs

Find with a regex for multiple patterns:

find -E . -regex ".*ext1|.*ext2|.*ext3"

first line of file:

head -n 1 filename

grep -o : only display match

Match patterns in file and output matches or matched groups:

Match files, patterns in files, and pipe matches to file:

Microsoft teaming up with Red Hat for RHEL on Azure (and RH looking at node.js and Java integration options)

Red Hat recently announced a partnership with Microsoft where Microsoft is now offering Red Hat Enterprise Linux (RHEL) as an option on Azure. Although Microsoft has been offering Linux based IaaS offerings on Azure for a few years already, adding RHEL to the mix introduces an option with the backing of Red Hat enterprise support.

Red Hat are also apparently looking to increase integration options between Java and node.js for it’s clients, according to Rich Sharples, senior director for product management at Red Hat, recently speaking at a node.js conference in Portland.

Wiring an Adafruit i2c LCD PiPlate to an Arduino (update 2)

I just dug my Arduino and LCD Pi Plate out of the cupboard for a little project. When I last posted about the PiPlate to Arduino wiring, I linked to a page that showed the names of the GPIO pins, but not the numbers I was referring to. Here is a better reference for the GPIO pin numbers.

The PiPlate to Arduino pin wiring I had before is still correct, providing you’re using the same pin numbering as in the above linked article.

The current gen x86-64 cpu architecture was designed by AMD

If you download a typical Linux distro (eg Kubuntu’s download page, you have the option of picking the 32 bit i386 version or the 64 bit AMD64 version. Hold on, I have an Intel i7, so where’s the 64 bit download for Intel CPUs?

Intel’s i86-64 CPUs (i7, i5, i3 and Core 2) are actually based on AMD’s AMD64 CPU spec, released in 2000. The names i86-64 and AMD64 are just Intel and AMD’s names for the same thing. Huh, did not know that.