Have the below perl grep regex and it’s working properly.
my @cont = grep {/,\s*511747450\s*,\s*CAN2\s*$/} @fileContents;
I want to convert it to unix system grep and I tried the same regex using system command in the below way and it’s not working.
my $cmd="grep ,\s*5117474501\s*,\s*CAN2\s*\$ " . $dirPath . "/" .$fileName;
my $exitStatus =system($cmd);
\,*and$are special to the shell. Some more escaping is in order.Or you can simply avoid the shell by using the multi-arg form of
system.