Using the pipe operator (“|”) when executing system commandsRun retrieving stdout without using...

Can I cast Sunbeam if both my hands are busy?

Where does the expression "triple-A" comes from?

Georgian capital letter “Ⴒ” (“tar”) in pdfLaTeX

Is the union of a chain of elementary embeddings elementary?

Should I leave the first authourship of our paper to the student who did the project whereas I solved it?

Were Roman public roads build by private companies?

What does "synoptic" mean in avionics?

Renewed US passport, did not receive expired US passport

How to save PDFs from web for offline reading on an iPad?

How do email clients "send later" without storing a password?

Can a magnet rip protons from a nucleus?

How do you build a Dominant 7th chord?

Using the pipe operator ("|") when executing system commands

Is there a star over my head?

Might have gotten a coworker sick, should I address this?

Which ping implementation is Cygwin using?

How can I maximize the impact of my charitable donations?

Does a gnoll speak both Gnoll and Abyssal, or is Gnoll a dialect of Abyssal?

Why was "leaping into the river" a valid trial outcome to prove one's innocence?

My employer wants me to do a work of 6 months in just 2 months

Evidence that matrix multiplication cannot be done in O(n^2 poly(log(n))) time

Is it possible to PIVOT on a LIKE statement

Are Democrats more likely to believe Astrology is a science?

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?



Using the pipe operator (“|”) when executing system commands


Run retrieving stdout without using RunProcessRun Does not WorkTunnel a Mathematica command through SSH






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2












$begingroup$


I'd like to emulate



ls -tlra | grep <search term>


in Wolfram. I have tried



Module[{},
SetDirectory[dir]
RunProcess[{"ls", "-tlra", "|", "grep", <searchTerm>}, "StandardOutput"]
]


which doesn't seem to work. Is there a way to use the "pipe" operator when shelling out commands in Wolfram?










share|improve this question









$endgroup$














  • $begingroup$
    Try prepending "bash","-c" as I show in this answer.
    $endgroup$
    – Tim Laska
    10 hours ago


















2












$begingroup$


I'd like to emulate



ls -tlra | grep <search term>


in Wolfram. I have tried



Module[{},
SetDirectory[dir]
RunProcess[{"ls", "-tlra", "|", "grep", <searchTerm>}, "StandardOutput"]
]


which doesn't seem to work. Is there a way to use the "pipe" operator when shelling out commands in Wolfram?










share|improve this question









$endgroup$














  • $begingroup$
    Try prepending "bash","-c" as I show in this answer.
    $endgroup$
    – Tim Laska
    10 hours ago














2












2








2





$begingroup$


I'd like to emulate



ls -tlra | grep <search term>


in Wolfram. I have tried



Module[{},
SetDirectory[dir]
RunProcess[{"ls", "-tlra", "|", "grep", <searchTerm>}, "StandardOutput"]
]


which doesn't seem to work. Is there a way to use the "pipe" operator when shelling out commands in Wolfram?










share|improve this question









$endgroup$




I'd like to emulate



ls -tlra | grep <search term>


in Wolfram. I have tried



Module[{},
SetDirectory[dir]
RunProcess[{"ls", "-tlra", "|", "grep", <searchTerm>}, "StandardOutput"]
]


which doesn't seem to work. Is there a way to use the "pipe" operator when shelling out commands in Wolfram?







run






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 10 hours ago









GeorgeGeorge

6801 silver badge12 bronze badges




6801 silver badge12 bronze badges















  • $begingroup$
    Try prepending "bash","-c" as I show in this answer.
    $endgroup$
    – Tim Laska
    10 hours ago


















  • $begingroup$
    Try prepending "bash","-c" as I show in this answer.
    $endgroup$
    – Tim Laska
    10 hours ago
















$begingroup$
Try prepending "bash","-c" as I show in this answer.
$endgroup$
– Tim Laska
10 hours ago




$begingroup$
Try prepending "bash","-c" as I show in this answer.
$endgroup$
– Tim Laska
10 hours ago










1 Answer
1






active

oldest

votes


















5














$begingroup$

For example:



RunProcess[{"bash", "-c", 
"ls -ltr | grep wolf "}, "StandardOutput",
ProcessDirectory -> $InstallationDirectory]
(* "-rwxr-x---+ 1 Administrators None 551360 Apr 8 09:51
wolfram.exe
-rwxr-x---+ 1 Administrators None 2390464 Apr 8 09:52
wolframscript.exe *)





share|improve this answer









$endgroup$


















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "387"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });















    draft saved

    draft discarded
















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f205057%2fusing-the-pipe-operator-when-executing-system-commands%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    $begingroup$

    For example:



    RunProcess[{"bash", "-c", 
    "ls -ltr | grep wolf "}, "StandardOutput",
    ProcessDirectory -> $InstallationDirectory]
    (* "-rwxr-x---+ 1 Administrators None 551360 Apr 8 09:51
    wolfram.exe
    -rwxr-x---+ 1 Administrators None 2390464 Apr 8 09:52
    wolframscript.exe *)





    share|improve this answer









    $endgroup$




















      5














      $begingroup$

      For example:



      RunProcess[{"bash", "-c", 
      "ls -ltr | grep wolf "}, "StandardOutput",
      ProcessDirectory -> $InstallationDirectory]
      (* "-rwxr-x---+ 1 Administrators None 551360 Apr 8 09:51
      wolfram.exe
      -rwxr-x---+ 1 Administrators None 2390464 Apr 8 09:52
      wolframscript.exe *)





      share|improve this answer









      $endgroup$


















        5














        5










        5







        $begingroup$

        For example:



        RunProcess[{"bash", "-c", 
        "ls -ltr | grep wolf "}, "StandardOutput",
        ProcessDirectory -> $InstallationDirectory]
        (* "-rwxr-x---+ 1 Administrators None 551360 Apr 8 09:51
        wolfram.exe
        -rwxr-x---+ 1 Administrators None 2390464 Apr 8 09:52
        wolframscript.exe *)





        share|improve this answer









        $endgroup$



        For example:



        RunProcess[{"bash", "-c", 
        "ls -ltr | grep wolf "}, "StandardOutput",
        ProcessDirectory -> $InstallationDirectory]
        (* "-rwxr-x---+ 1 Administrators None 551360 Apr 8 09:51
        wolfram.exe
        -rwxr-x---+ 1 Administrators None 2390464 Apr 8 09:52
        wolframscript.exe *)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 10 hours ago









        Tim LaskaTim Laska

        2,3781 gold badge3 silver badges13 bronze badges




        2,3781 gold badge3 silver badges13 bronze badges


































            draft saved

            draft discarded



















































            Thanks for contributing an answer to Mathematica Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f205057%2fusing-the-pipe-operator-when-executing-system-commands%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

            Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

            Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...