column Removes Whitespaces at Process Substitutions
Clash 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.
columns text-formatting
add a comment |Â
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.
columns text-formatting
add a comment |Â
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.
columns text-formatting
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.
columns text-formatting
asked Mar 31 at 14:48
sjngm
1488
1488
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password