Thanks for updating the above solution but this is not perfect.
How ...
xyz.com/for-sale --- index / robots - follow -- ok
xyz.com/search --- index / robots - follow -- ok here dont want follow - want nofollow
xyz.com/for-sale/1 --- pagetation pages -- index / robots - follow -- ok
So, I am referring to some other theme code and modified as per below & this is the perfect solution that I want.
<?php if( osc_count_items() == 0 || stripos($_SERVER['REQUEST_URI'], 'search') ) { ?>
<meta name="robots" content="noindex, nofollow" />
<meta name="googlebot" content="noindex, nofollow" />
<?php } else { ?>
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<?php } ?>
Now output --->
xyz.com/for-sale --- index / robots - follow -- ok
xyz.com/search --- index / robots - nofollow -- ok
xyz.com/for-sale/1 --- pagetation pages -- index / robots - follow -- ok
hope the above new solution work well for everyone.