'Can't Activate Document in Pipeline (unix script)
I'm trying to run the program bayes-seg with: cat data/books/clinical/050.ref | ./segment config/dp.config using Powershell.
I understand that the command cat outputs the file and pipe will use the output as a parameter to ./segment config/dp.config
When running the above command. I'm met with the exception:
Cannot run a document in the middle of a pipeline: C:\Users\name\Desktop\bayes-seg-master\segment.
At line:1 char:35
+ cat data/books/clinical/050.ref | ./segment config/dp.config
+ CategoryInfo: InvalidOperation: (C:\Users\name\...-master\segment:String) [], RuntimeException
+ FullyQualifiedErrorId : CantActivateDocumentInPipeline
What causes this exception? I've looked around on Google and could not find anything which explains the exception in detail. Any help would be greatly appreciated.
Solution 1:[1]
As the executable segment.exe is not aware of PowerShell style pipeline, you must use ForEach-Object to specify a specific argument to segment.exe:
cat data/books/clinical/050.ref | %{ ./segment config/dp.config $_ }
As I'm not aware of this executable usage, you may need to adapt the arguments as you need.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
