How's the right way to pipe stdout & stderr from ping into an awk program? [duplicate]












-1















This question already has an answer here:




  • Piping both stdout and stderr in bash?

    2 answers




Here's an excerpt of some commands that I've been trying to evaluate from a Zsh script:



cmd="ping -qc 3 -W 5 8.8.8.8 | xargs -0d 'n' awk -f presetup/testping.awk 2>&1"
print -r ${cmd}
output=$(eval ${cmd})
print ${output}


I don't know what I'm missing but, all I'm trying to do is to process the stderr & stdout of ping with a single awk script. Here's the output I'm getting:



awk: presetup/testping.awk:6: fatal: cannot open file `PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.' for reading (No such file or directory)


The program is supposed to parse each output line of the ping command and match with regular expressions its output. Any ideas of what I'm missing?










share|improve this question















marked as duplicate by tripleee, Community Nov 16 at 1:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    xargs is wrong there, you have to pipe stdout and stderr to awk.
    – karakfa
    Nov 13 at 19:09










  • @karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
    – ScutulatIum
    Nov 13 at 21:41










  • @karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
    – ScutulatIum
    Nov 13 at 21:48


















-1















This question already has an answer here:




  • Piping both stdout and stderr in bash?

    2 answers




Here's an excerpt of some commands that I've been trying to evaluate from a Zsh script:



cmd="ping -qc 3 -W 5 8.8.8.8 | xargs -0d 'n' awk -f presetup/testping.awk 2>&1"
print -r ${cmd}
output=$(eval ${cmd})
print ${output}


I don't know what I'm missing but, all I'm trying to do is to process the stderr & stdout of ping with a single awk script. Here's the output I'm getting:



awk: presetup/testping.awk:6: fatal: cannot open file `PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.' for reading (No such file or directory)


The program is supposed to parse each output line of the ping command and match with regular expressions its output. Any ideas of what I'm missing?










share|improve this question















marked as duplicate by tripleee, Community Nov 16 at 1:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 2




    xargs is wrong there, you have to pipe stdout and stderr to awk.
    – karakfa
    Nov 13 at 19:09










  • @karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
    – ScutulatIum
    Nov 13 at 21:41










  • @karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
    – ScutulatIum
    Nov 13 at 21:48
















-1












-1








-1








This question already has an answer here:




  • Piping both stdout and stderr in bash?

    2 answers




Here's an excerpt of some commands that I've been trying to evaluate from a Zsh script:



cmd="ping -qc 3 -W 5 8.8.8.8 | xargs -0d 'n' awk -f presetup/testping.awk 2>&1"
print -r ${cmd}
output=$(eval ${cmd})
print ${output}


I don't know what I'm missing but, all I'm trying to do is to process the stderr & stdout of ping with a single awk script. Here's the output I'm getting:



awk: presetup/testping.awk:6: fatal: cannot open file `PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.' for reading (No such file or directory)


The program is supposed to parse each output line of the ping command and match with regular expressions its output. Any ideas of what I'm missing?










share|improve this question
















This question already has an answer here:




  • Piping both stdout and stderr in bash?

    2 answers




Here's an excerpt of some commands that I've been trying to evaluate from a Zsh script:



cmd="ping -qc 3 -W 5 8.8.8.8 | xargs -0d 'n' awk -f presetup/testping.awk 2>&1"
print -r ${cmd}
output=$(eval ${cmd})
print ${output}


I don't know what I'm missing but, all I'm trying to do is to process the stderr & stdout of ping with a single awk script. Here's the output I'm getting:



awk: presetup/testping.awk:6: fatal: cannot open file `PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.' for reading (No such file or directory)


The program is supposed to parse each output line of the ping command and match with regular expressions its output. Any ideas of what I'm missing?





This question already has an answer here:




  • Piping both stdout and stderr in bash?

    2 answers








awk zsh xargs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 21:58

























asked Nov 13 at 18:09









ScutulatIum

13




13




marked as duplicate by tripleee, Community Nov 16 at 1:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by tripleee, Community Nov 16 at 1:00


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 2




    xargs is wrong there, you have to pipe stdout and stderr to awk.
    – karakfa
    Nov 13 at 19:09










  • @karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
    – ScutulatIum
    Nov 13 at 21:41










  • @karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
    – ScutulatIum
    Nov 13 at 21:48
















  • 2




    xargs is wrong there, you have to pipe stdout and stderr to awk.
    – karakfa
    Nov 13 at 19:09










  • @karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
    – ScutulatIum
    Nov 13 at 21:41










  • @karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
    – ScutulatIum
    Nov 13 at 21:48










2




2




xargs is wrong there, you have to pipe stdout and stderr to awk.
– karakfa
Nov 13 at 19:09




xargs is wrong there, you have to pipe stdout and stderr to awk.
– karakfa
Nov 13 at 19:09












@karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
– ScutulatIum
Nov 13 at 21:41




@karakfa, thanks for your input. I removed xargs and tried this: ping -qc 3 -W 5 8.8.8.8 2>&1 awk -f presetup/testping.awk - without success. I had the following output: ping: -: Name or service not known.
– ScutulatIum
Nov 13 at 21:41












@karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
– ScutulatIum
Nov 13 at 21:48






@karakfa, nevermind, I found it. The right way seems to be the following: ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk - Thanks for pointing me into the right direction!
– ScutulatIum
Nov 13 at 21:48














1 Answer
1






active

oldest

votes


















-1














Thank you so much for pointing me into the right direction @karakfa. It seems that the right way is as follows:



ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk -


CORRECTION, redirect stderr to stdout, then pipe stdout to awk:



ping -qc 3 -W 5 8.8.8.8 2>&1 | awk -f presetup/testping.awk


OR:



ping -qc 3 -W 5 8.8.8.8 |& awk -f presetup/testping.awk


Thanks @tripleee!






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    -1














    Thank you so much for pointing me into the right direction @karakfa. It seems that the right way is as follows:



    ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk -


    CORRECTION, redirect stderr to stdout, then pipe stdout to awk:



    ping -qc 3 -W 5 8.8.8.8 2>&1 | awk -f presetup/testping.awk


    OR:



    ping -qc 3 -W 5 8.8.8.8 |& awk -f presetup/testping.awk


    Thanks @tripleee!






    share|improve this answer




























      -1














      Thank you so much for pointing me into the right direction @karakfa. It seems that the right way is as follows:



      ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk -


      CORRECTION, redirect stderr to stdout, then pipe stdout to awk:



      ping -qc 3 -W 5 8.8.8.8 2>&1 | awk -f presetup/testping.awk


      OR:



      ping -qc 3 -W 5 8.8.8.8 |& awk -f presetup/testping.awk


      Thanks @tripleee!






      share|improve this answer


























        -1












        -1








        -1






        Thank you so much for pointing me into the right direction @karakfa. It seems that the right way is as follows:



        ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk -


        CORRECTION, redirect stderr to stdout, then pipe stdout to awk:



        ping -qc 3 -W 5 8.8.8.8 2>&1 | awk -f presetup/testping.awk


        OR:



        ping -qc 3 -W 5 8.8.8.8 |& awk -f presetup/testping.awk


        Thanks @tripleee!






        share|improve this answer














        Thank you so much for pointing me into the right direction @karakfa. It seems that the right way is as follows:



        ping -qc 3 -W 5 8.8.8.8 | 2>&1 awk -f presetup/testping.awk -


        CORRECTION, redirect stderr to stdout, then pipe stdout to awk:



        ping -qc 3 -W 5 8.8.8.8 2>&1 | awk -f presetup/testping.awk


        OR:



        ping -qc 3 -W 5 8.8.8.8 |& awk -f presetup/testping.awk


        Thanks @tripleee!







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 14 at 16:35

























        answered Nov 13 at 22:00









        ScutulatIum

        13




        13















            Popular posts from this blog

            鏡平學校

            ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

            Why https connections are so slow when debugging (stepping over) in Java?