How to use $system with substitutions SV/UVM

Hi All ,

I want to use the below format :

$system(“ls %s%h”,dir_name,log_num);

Where dir_name is a string and log_num is a number,
but i am unable to do this from System verilog since $system is not taking substitutions .

I tried with strings but i am unable to get the number format properly when i cast the number to string.

How to handled these kind of problems ?

In reply to ravitejatelugunta:

Try using string cmd = $sformartf(“ls %s%h”,dir_name,log_num);, then $system(cmd);

HTH,
-R