Posts

Showing posts from 2011

Replace String in Unix

To replace all instances of a string in a directory (subdirectories included) do: Code: perl -e "s/FIND/REPLACE/g;" -pi.save $(find path/to/DIRECTORY -type f) The above will make a backup temp file of your original  If you do not want a temp file with the .save extension then do: Code: perl -e "s/FIND/REPLACE/g;" -pi $(find path/to/DIRECTORY -type f) -------------------- Example: You want to replace all instances of the word "design" with "dezine" in the directory /public_html/company/info you can execute the command from document root as  Code: perl -e "s/design/dezine/g;" -pi.save $(find public_html/company/info -type f) or you can execute the command from public_html/company/ (a directory above) as: Code: perl -e "s/design/dezine/g;" -pi.save $(find info -type f) ------------------------------ The above commands will search all files (.gif, .jpg, .htm, .html, .txt) so you might see some erro

Changing Windows Account password using Outlook

http://theessentialexchange.com/blogs/michael/archive/2007/11/24/changing-user-passwords-with-outlook-2003-2007.aspx . 1) Call the helpdesk - the most likely scenario if you are not in a hosted environment 2) Use the control panel - most Hosted Exchange providers provide a function on a user's control panel enabling the user to change their password, using the functionality in item (3). Most large companies will implement a similar capability for their users. Small companies will likely need to implement item (3) directly or their helpdesk will do it (as in item 1). 3) Enable IISADMPWD - use KB 555071 to enable the use of a web page to allow changing the password of an active directory user.

How to remove the dreaded '^M' character in unix files

While there are lots of ways to go about solving the issue, two methods that I find to my liking are: 1. Using 'tr' tr -d '^M' < [input filename] > [output filename] e.g; tr -d '^M' < opx_LOD_GEN_110_003110000.ini > test3.txt 2. Using vi editor. :%s/(ctrl-v)(ctrl-m)//g Simply type in the above in your vi editor to get the desired effect. And note that you have to press 'ctrl' AND 'V' and later 'ctrl' AND 'm'. It's not the same as the '^' and 'M' character. Both of them worked for me. Details can be found here: 1) http://www.tech-bits.com/index.php?View=entry&CategoryID=6&EntryID=54 2) http://www.devdaily.com/unix/edu/un010011/