0

I'm trying to reproduce a simple spam filter using naive bayes and Node.js on windows, I got a resource with these Unix commands and don't know how to run it on PowerShell:

sed -nr 's#^0 (.*)#training/\1#p' CSDMC2010_SPAM/CSDMC2010_SPAM/SPAMTrain.label | xargs node spamfilter.js -s

sed -nr 's#^1 (.*)#training/\1#p' CSDMC2010_SPAM/CSDMC2010_SPAM/SPAMTrain.label | xargs node spamfilter.js -h

SPAMTrain.label is a file contains training files' name and label (0 for spam and 1 for non-spam), after some searching, I know that sed command is used to replace text and xargs is used to bash. So I think these commands will figure out which TRAINING files are spam and which are non-spam. -s, -h are arguments I pass in to run the spamfilter.js

Is there any way I can run these 2 commands on PowerShell, or rewrite it to fit PowerShell command line?

1 Answer 1

1

You can use select-string in the powershell for sed in linux and Invoke-Expression for xargs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.