HP-UX system uid change

following is a procedure to make 2 SAP SIDadm users who share the same UNIX UID, live together on the same app server, by changing one of the user’s UID (including the files)

# first change in /etc/passwd
usermod -u newUID loginname

# now go recursively and change the files accordingly
find / -user oldUID -exec chown newUID {} \;

perl search & replace

a simple script i made to replace multiple appearance of a word in a raw or multiple raws, output to file.new


if ($#ARGV != 2) {
  print "this programs output is FILENAME.new\n";
  print "usage: search_Replace.pl
$newfile_name = "$ARGV[2].new";

print "Before : ",$ARGV[0],"\n";
print "After  : ",$ARGV[1],"\n";
print "Opening ... ";
open (OLDF, $ARGV[2]) ||
   die ("Could not open file. $!");
open (NEWF, ">$newfile_name") ||
   die ("Could not create output file. $!");
print "IN/OUT pipes are open.\n";
while ($text = ){
    $text =~ s/$ARGV[0]/$ARGV[1]/g;
    print NEWF "$text";
close (OLDF);
close (NEWF);