Thursday, December 27, 2007

crazy shell code

for i in $(ack ".+_[^_]+_[^_]+" include/libdodo/*Ex.h|grep -vE "(_STR|_H_)" | sed 's/,//' | gawk '{print $2}' | tr "\n" " "); do a=$(echo $i | sed -r 's/(.*[EX_]{3}).*/\1/'); b=$(echo $i | sed -r 's/.*[EX_]{3}(.*)/\1/'); c=$(echo $b | sed 's/_//g'); d="$a$c"; for j in $(find ./ | grep -E "(\.cc|\.h)$"); do sed -ri "s/$i/$d/g" $j; done; done
(c) Ni@m unix programmers are really lazy. This code searches for strings in 'Ex' headers that contain 'EX_' and some '_'. Then it removes '_' after '.*EX_' in the found string and replaces the old string with the new one in the project tree. Yep, I'm lazy-crazy ;)

No comments: