LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to order command output? (httpd -M) (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-order-command-output-httpd-m-4175705628/)

Colombia 12-31-2021 12:28 PM

how to order command output? (httpd -M)
 
hello,

this show not ordered output:
Code:

[root@cia ~]# httpd -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_prefork_module (shared)
 systemd_module (shared)
 cgi_module (shared)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 expires_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 proxy_module (shared)
 proxy_ajp_module (shared)
 proxy_fcgi_module (shared)
 proxy_http_module (shared)
 proxy_wstunnel_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 slotmem_shm_module (shared)
 socache_dbm_module (shared)
 socache_shmcb_module (shared)
 socache_redis_module (shared)
 status_module (shared)
 unique_id_module (shared)
 unixd_module (shared)
 userdir_module (shared)
 bwlimited_module (shared)
 ssl_module (shared)
 security2_module (shared)
 ruid2_module (shared)
[root@cia ~]#

how I can order the list ?

I try with
Code:

sort -o httpd -M
sort httpd -M
httpd -M --sort

but fail


thanks

Colombia 12-31-2021 12:47 PM

Quote:

Originally Posted by Colombia (Post 6313714)
how I can order the list ?

I try with
Code:

sort -o httpd -M
sort httpd -M
httpd -M --sort

but fail

and how get the NUMBER total of modules?

pan64 12-31-2021 12:56 PM

Code:

httpd -M | sort
httpd -M | wc


Turbocapitalist 01-01-2022 12:10 AM

Or even this:

Code:

httpd -M | sort | cat -n

httpd -M | sort | cat -n | column

And so on.

Going from left to right, the stdout of one program becomes the stdin of the next. The pipeline can be made arbitrarily long by connecting more utilities with pipes.

Edit: I notice an off-by-one error in the above approaches, since the title line is not itself a module name:

Code:

httpd -M | grep -v Loaded | sort -k2,2r -k1,1 | cat -n
See the manual pages for grep, sort, and cat.

Colombia 01-01-2022 07:54 AM

many thanks by the helps


:-)


All times are GMT -5. The time now is 04:10 PM.