in reply to Re: Using system command not able to run though the script
in thread Using system command not able to run though the script

Using command in scripts still getting the error message . system(qq{simple_pin_$thost.pl $thost | findstr \n "2016 TTL timed" >> ping_$thost.txt}); #system("simple_pin_$thost.pl $thost | findstr \n \"2016 TTL timed\" >> ping_$thost.txt" ); ERROR Message : FINDSTR: Bad command line -Ajay
  • Comment on Re^2: Using system command not able to run though the script

Replies are listed 'Best First'.
Re^3: Using system command not able to run though the script
by haukex (Archbishop) on Sep 08, 2016 at 07:30 UTC

    Hi chopraa,

    When you write "... \n ...", that is interpolated and produces a newline character in the string. If you want to send the literal string \n to the shell, then in your Perl string you have to escape the backslash and write "... \\n ..." or qq{... \\n ...}. However, NetWallah has a good point, perhaps you meant /n?

    Hope this helps,
    -- Hauke D