#!/usr/bin/perl @array = `ps -ef | grep kdfadm`; @A = grep (/\/opt\/kdf\/home/, @array); my @A = split; print $A[1];