column Removes Whitespaces at Process Substitutions

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I try to display two statistics of my nginx-server side-by-side. My first approach for this is column and process substitution.



column <(
echo "sorted by busiest access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
sort -nk 1 |
tail -25
) <(
echo "recent access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
tail -25
)


Becomes:



sorted by busiest access times: recent access times:
80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
84 2018-03-25 18:xx h 17 2018-03-30 11:xx h


Yikes, ugly. Where did the leading whitespaces go? OK, workaround with paste:



paste -d '#' <(
echo "sorted by busiest access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
sort -nk 1 |
tail -25
) <(
echo "recent access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
tail -25
) | column -ts '#'


Better. However, the leading whitespaces are still missing:



sorted by busiest access times: recent access times:
80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
...


Now I add a <(echo) as the first process substitution:



paste -d '#' <(echo) <(
echo "sorted by busiest access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
sort -nk 1 |
tail -25
) <(
echo "recent access times:"
egrep -v " /hs/|GET /favicon|GET / " $file |
sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
date -f - +'%Y-%m-%d %H:xx h' |
uniq -c |
tail -25
) | column -ts '#'


The output becomes:



 sorted by busiest access times: recent access times:
80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
...


Even better, but now I have two spaces at the beginning of each line, which shouldn't be there. Well, I could remove those two with an additional | sed -e 's/^..//' after column, but I'm starting to think that I'm missing the actual problem here.



What's a better approach or am I actually doing it right? Or can I make column keep the leading whitespaces?



I'm using Manjaro if that's of significance.







share|improve this question
























    up vote
    1
    down vote

    favorite












    I try to display two statistics of my nginx-server side-by-side. My first approach for this is column and process substitution.



    column <(
    echo "sorted by busiest access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    sort -nk 1 |
    tail -25
    ) <(
    echo "recent access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    tail -25
    )


    Becomes:



    sorted by busiest access times: recent access times:
    80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
    81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
    82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
    83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
    84 2018-03-25 18:xx h 17 2018-03-30 11:xx h


    Yikes, ugly. Where did the leading whitespaces go? OK, workaround with paste:



    paste -d '#' <(
    echo "sorted by busiest access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    sort -nk 1 |
    tail -25
    ) <(
    echo "recent access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    tail -25
    ) | column -ts '#'


    Better. However, the leading whitespaces are still missing:



    sorted by busiest access times: recent access times:
    80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
    81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
    82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
    83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
    84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
    ...


    Now I add a <(echo) as the first process substitution:



    paste -d '#' <(echo) <(
    echo "sorted by busiest access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    sort -nk 1 |
    tail -25
    ) <(
    echo "recent access times:"
    egrep -v " /hs/|GET /favicon|GET / " $file |
    sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
    date -f - +'%Y-%m-%d %H:xx h' |
    uniq -c |
    tail -25
    ) | column -ts '#'


    The output becomes:



     sorted by busiest access times: recent access times:
    80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
    81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
    82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
    83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
    84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
    ...


    Even better, but now I have two spaces at the beginning of each line, which shouldn't be there. Well, I could remove those two with an additional | sed -e 's/^..//' after column, but I'm starting to think that I'm missing the actual problem here.



    What's a better approach or am I actually doing it right? Or can I make column keep the leading whitespaces?



    I'm using Manjaro if that's of significance.







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I try to display two statistics of my nginx-server side-by-side. My first approach for this is column and process substitution.



      column <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      )


      Becomes:



      sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h


      Yikes, ugly. Where did the leading whitespaces go? OK, workaround with paste:



      paste -d '#' <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      ) | column -ts '#'


      Better. However, the leading whitespaces are still missing:



      sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
      ...


      Now I add a <(echo) as the first process substitution:



      paste -d '#' <(echo) <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      ) | column -ts '#'


      The output becomes:



       sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
      ...


      Even better, but now I have two spaces at the beginning of each line, which shouldn't be there. Well, I could remove those two with an additional | sed -e 's/^..//' after column, but I'm starting to think that I'm missing the actual problem here.



      What's a better approach or am I actually doing it right? Or can I make column keep the leading whitespaces?



      I'm using Manjaro if that's of significance.







      share|improve this question












      I try to display two statistics of my nginx-server side-by-side. My first approach for this is column and process substitution.



      column <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      )


      Becomes:



      sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h


      Yikes, ugly. Where did the leading whitespaces go? OK, workaround with paste:



      paste -d '#' <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      ) | column -ts '#'


      Better. However, the leading whitespaces are still missing:



      sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
      ...


      Now I add a <(echo) as the first process substitution:



      paste -d '#' <(echo) <(
      echo "sorted by busiest access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      sort -nk 1 |
      tail -25
      ) <(
      echo "recent access times:"
      egrep -v " /hs/|GET /favicon|GET / " $file |
      sed -e 's/^[^+[|:..:.. .*//g; s/:/ /; s///-/g' |
      date -f - +'%Y-%m-%d %H:xx h' |
      uniq -c |
      tail -25
      ) | column -ts '#'


      The output becomes:



       sorted by busiest access times: recent access times:
      80 2018-03-28 20:xx h 6 2018-03-29 23:xx h
      81 2018-03-31 15:xx h 1 2018-03-30 01:xx h
      82 2018-02-25 16:xx h 23 2018-03-30 08:xx h
      83 2018-03-15 19:xx h 15 2018-03-30 09:xx h
      84 2018-03-25 18:xx h 17 2018-03-30 11:xx h
      ...


      Even better, but now I have two spaces at the beginning of each line, which shouldn't be there. Well, I could remove those two with an additional | sed -e 's/^..//' after column, but I'm starting to think that I'm missing the actual problem here.



      What's a better approach or am I actually doing it right? Or can I make column keep the leading whitespaces?



      I'm using Manjaro if that's of significance.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 31 at 14:48









      sjngm

      1488




      1488

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434685%2fcolumn-removes-whitespaces-at-process-substitutions%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434685%2fcolumn-removes-whitespaces-at-process-substitutions%23new-answer', 'question_page');

          );

          Post as a guest













































































          UTHHQL,XCDKRi h,Q8g7sl,QP8VrmWwBXN H3H CI QqYZRunGlGQPsLfqa0cjngc2INcT63L mDjB nB BUoM0607
          Ldnfvas,wKplJ o1zejcPNMnMU7DbAjzdw

          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          How many registers does an x86_64 CPU actually have?

          Displaying single band from multi-band raster using QGIS