Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

group values of same option on one line 1

Status
Not open for further replies.

w5000

Technical User
Nov 24, 2010
223
0
0
PL
hello,
sshd -T prints all options configured for sshd at the moment (defaults + config file)

output of
sshd -T|sort -u|sed s/\ /\=/

I would like to process to get same options values listed in one line and values comma separated, so, eg:

hostkey=/etc/ssh/ssh_host_dsa_key
hostkey=/etc/ssh/ssh_host_ecdsa_key
hostkey=/etc/ssh/ssh_host_rsa_key

listed as:
hostkey=/etc/ssh/ssh_host_dsa_key,/etc/ssh/ssh_host_ecdsa_key,/etc/ssh/ssh_host_rsa_key

(and all other options listed as they are)

thank you in advance for some ease method with e.g. awk oneliner
 
Try:
Code:
/usr/sbin/sshd -T|awk '{k=$1; a[k]=a[k]","$2;}END{for (k in a) print k,a[k];}'
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top