TextMate Find & Replace Using Regular Expressions

While working on a new section of the Question-Defense.com web site that will include articles related to Kali Linux I was creating a menu system that would be similar to the Kali Linux menu system. Once the menu was completed with the necessary content and was visually what I was looking for I needed to go back and make some enhancements for SEO (Search Engine Optimization). The goal was to add a HTML title tag where a HTML alt tag already existed and I knew this shouldn’t be to hard to accomplish using regular expressions via TextMate’s find and replace function. Below I describe the issue in more detail along with the regular expression syntax that can be used to accomplish this in the TextMate find and replace window. Please make sure to backup all files you are going to modify before beginning so you can always rollback if need be.

Technology Insights

Append Or Prepend Text To Every Line In Text File With Notepad++

When I need to use Windows either for Microsoft Office products or some other reason I find myself in Notepad++ a lot. Notepad++ is a great free tool that provides a ton of functionality including the ability to easily add plugins, etc. One great feature of Notepad++ is the Regular Expression capabilities when using find/replace. If you wanted to add data to the beginning of each line or add data to the end of each line you can easily do so using find and replace with Regular Expressions enabled as shown in the below examples.

Code Snippets

Bash Script That Deletes Directories Older Than X Days If Y Number Of Directories Exist

Earlier tonight I created a little script that will run in cron on a Linux server. The script counts the number of directories and files in a specific directory and if the count is above Y then it deletes directories and files older than X number of days. In the example script below the number of items (directories and files) that have to be located in the directory before the script to delete files older than a specific date is 10. If there are ten items then the script will delete items older than 90 days. Below the script is the entry made in a specific users cron on the Linux server.

Technology Insights

How to Easily Find Your Windows Product Key

I recently had a friend who wanted to find out his windows product key. his sticker had worn off his computer and he needed to reinstall Windows. There is a great tool for this called the Magical Jellybean Keyfinder. I have been using it for years and it has just been a great tool. It will not only find wour Operating System product key but it will also find the keys for all Windows based products such as Office, Visio and Project. Its a simple tool to get and use but it is a real blessing in many IT situations.