Useful Commands


Changing Password

passwd

Restarting Mysql daemon


cd /root/sbin
sh interfaces.sh
service mysqld start
/usr/sbin/httpd -k restart


Search and Replace

for i in `ls -1 |grep shoes`; do perl searchreplace.pl $i; done
Replace "shoes" with pattern in file names.


searchreplace.pl source:
#!/usr/bin/perl
$myfile=@ARGV[0];
#$searchs='cellspacing="0" align="left"';
#$replaces='cellspacing="2"';
open(FIN,"<".$myfile) or die "Search and Replace";
$template="";
$count=1;
$searchquery="";
while(<FIN>)
{	
#	$searchquery=$1;
#	}	
	$myline=$_;
#	$myline =~ s/\t/;/gi;
#	if ($myline =~ m/Comparison shop ([a-zA-Z\ ]+) at:/) {
#  		$searchquery=$1;
#	}


#	$myline =~ s/Comparison shop/<img src="http:\/\/ftjcfx.com\/image-" height="1" width="1"><SCRIPT LANGUAGE="Javascript" SRC="http:\/\/affiliate.shoebuy.com\/sb\/bs.jsp?Req=prof&Brand=xxxxxxxx&Page=1&col=4&row=4&sort=-POPULAR&pid=12345&aid=56789&newWin=1&price=1&fst=1&cssType=default"><\/SCRIPT><br\/><br\>Comparison shop/g;	
	$myline =~ s/<h1><b>What is /<h1><b>/g;
	#$myline = "swimandshoes-200406_".$myline;
	$template=$template.$myline;
	#$count=$count+1;
}

#$template =~ s/xxxxxxxx/$searchquery/;

#$template =~ s/bgcolor=([a-z]+)/bgcolor="$1"/ig;
#}
#print $searchname;
#$template =~ s/<\/head>/<\/object><\/head>/;


close(FIN);
open(FOUT,">".$myfile);
print FOUT $template;
close(FOUT);





Return to Po-Han Lin's Depot