Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Executing grep command

$
0
0
I am using the ssh.net library and I am trying to run the following command:
string theCommand=grep <stringToLookFor> <filePathAndName>
client.RunCommand(theCommand);

The process hangs.

Then I tried using asynch:
SshCommand cmd=client.CreateCommand("grep "+stringInFile+" " + directory+fileName);
var asynch=cmd.BeginExecute();
while (!asynch.IsCompleted)
        {
           System.Threading.Thread.Sleep(100);

        }
        cmd.EndExecute(asynch);
And it does not return neither.

Any ideas on how I can run this grep command?
Thanks.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>