Replace a string in all files within a directory

Here is a single line command which replaces a string in all files contained within a directory using sed.

sed -i 's/old-string/new-string/g' dir/*

You can also replace the *(asterisk) if you want to just replace specific files

sed -i 's/old-string/new-string/g' dir/*.txt

Advertisements

DotA Map 6.66b Released

A new Dota Map has been release, but before you can using it, as same as the other later map versions, you have to patch Warcraft III The Frozen Throne to 1.24. You can download the Patch by Clicking Here. Changelog of this update is

————————————————————————–
Patch 1.24
————————————————————————–

PC WORLD EDITOR CHANGES

– Added new JASS hash table functions to replace the lost functionality from
fixing unsafe type casting.
– Hash Table – Save Item Handle
– Hash Table – Save Unit Handle
– …
– Hash Table – Load Item Handle
– Hash Table – Load Unit Handle
– …
– Hash Table – Get Handle ID

FIXES

– Fixed an exploit related to unsafe type casting that allowed users to
execute arbitrary code in maps.
– Fixed the JASS unsafe type casting exploit (“return bug”).
– Fixed several World Editor crashes.

ADDITIONAL
‚ÄĘ ‚ÄúShadowing‚ÄĚ global variables with local variables no longer is possible.
‚ÄĘ Fixed a type conversion dealing with operators (i.e. adding a handle with an integer)
‚ÄĘ Added the ability to store hashtable handles in a hashtable
‚ÄĘ Added getSpellTargetX and getSpellTargetY natives
‚ÄĘ Added a new base handle type ‚ÄúAgent‚ÄĚ of which many types now extend from.
‚ÄĘ Added a SaveAgentHandle native which can be used for saving most handle types
‚ÄĘ Added a JASS optimization dealing with global variable change events.
‚ÄĘ Increased max map file size from 4MB to 8MB.

Also, this patch enables you to run newer Dota Maps, latest is 6.66b and you can download it here. Map Changelogs are also found on that site.

An advanced valentine script for you

Whew, this is quite embarrassing, I have all the time in the world to do some posts, but due to addiction with PC Games, I neglect my duties. I even forgot to posts my New Year’s greeting, anyways, I’ll do that during the Chinese New Year. For now, I saw a blog in which he created a linux/unix script for Valentines, this was posted last year but I am reposting it here now.¬† ūüôā

Here is the output and below is the code. Obviously this was dedicated to his wife, so right now I am dedicating it to my wife Mae Fatima as well.

#!/bin/bash

#
# hvd.sh - Happy Valentine's Day To The Love Of My Life - My Wonderful Wife :)

echo -en "\thugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&\n
\t&            hugs&kisses&hugs&kisses&hu         &hugs&kisses\n
\ts&h        es&hugs&kisses&hugs&kiss                 gs&kisse\n
\tes&h      sses&hugs&kisses&hugs&k                     s&kiss\n
\tses&      isses&hugs&kisses&hugs            &kiss      s&kis\n
\tsses      kisses&hugs&kisses&hu           ugs&kiss      s&ki\n
\tisse      &kisses&hugs&kisses&h          &hugs&kiss     gs&k\n
\tkiss      s&kisses&hugs&kisses&         es&hugs&kis     ugs&\n
\t&kis      gs&kisses&hugs&kisses        sses&hugs&k      hugs\n
\ts&ki      ugs&kisses&hugs&kisse       kisses&hugs       &hug\n
\tgs&k      hugs&kisses&hugs&kiss      s&kisses&hu        s&hu\n
\tugs&      &hugs&kisses&hugs&kis     ugs&kisses&         es&h\n
\thugs      s&hugs&kisses&hugs& i     hugs&kisse          ses&\n
\t&hug      es&hugs&kisses&hug  k      hugs&kis           sses\n
\ts&hu      ses&hugs&kisses&h   &       hugs&             isse\n
\tes&h      sses&hugs&kisse     s&                       &kiss\n
\ts                             gs&ki                 hugs&kis\n
\ts                             ugs&kisse         sses&hugs&ki\n
\ti             ses&h                                        k\n
\tk             sses&                                        &\n
\t&kis      gs&kisses&hug   isses&hugs      s&hugs&kisse     s\n
\ts&kis      gs&kisses&h   &kisses&hug      es&hugs&kisses   g\n
\tgs&ki      ugs&kisses&   s&kisses&hu      ses&hugs&kisses  u\n
\tugs&ki      ugs&kisse   ugs&kisses&h      sses&hugs&kisses h\n
\thugs&k      hugs&kiss   hugs&kisses&      isses&h gs&kisses&\n
\t&hugs&k      hugs&ki   s&hugs&kisses      kisses  ugs&kisses\n
\ts&hugs&      &hugs&k   es&hugs&kisse              hugs&kisse\n
\tes&hugs&      &hugs   sses&hugs&kiss      s&kiss  &hugs&kiss\n
\tses&hugs      s&hug   isses&hugs&kis      gs&kiss s&hugs&kis\n
\tsses&hugs      s&h   &kisses&hugs&ki      ugs&kisses&hugs& i\n
\tisses&hug      es&   s&kisses&hugs&k      hugs&kisses&hug  k\n
\tkisses&hug      e   ses&kisses&hugs&      &hugs&kisses&hu  &\n
\t&kisses&hu         isses&hugs&k                            s\n
\ts&kisses&hu       &kisses&hugs&                            g\n
\tgs&kisses&hu     gs&kisses&hugs                            u\n
\tkisses&hugs&kisses&hugs&kisses&hugs&kisses&hugs&kisses&hugs&"