
However, this command works through Unix shell (without the backslash before the $): grep '^.*\.*$' file.txt > file2.txtįile2.txt output: 21343 dir1/dir2/dir3/dir4/file.B2 I have a file ( file.txt): 23445 dir1/dir2/dir3įrom this file I'm trying to grep only the lines with files (exclude directories: lines 1 and 4), and store them in a new file: system("grep '^.*\.*\$' file.txt > file2.txt") įile2.txt doesn't change from file.txt and still contains the directories. I've tested with Mobaxterm v7.1 and Putty 0.60. I've had more complex regex commands I had to adjust accordingly to convert from Unix to Perl, and they're working fine, but I can't seem to figure out what's missing here.


I'm having trouble executing a Perl script through the Unix shell using Perl's system command.
