search/filter on user groups using sed/awk
by oliveoyl from LinuxQuestions.org on (#581QY)
Hello,
Looking to filter the ouput of id command on particular group that will always begins with tdh_mbc_ and there is only going to be exactly one.
$ id -nG
vqh_ub5 tdh-benjo pbl_tubogpse pbl_svuin tdh_dmvtufs_benjot tdh_dmvtufs_vtfst tdh_dmvtufs_bqqt tdh_mbc_svuin dmfbobjs_dmvtufs_vtfst tdh_httd_vtfst pbl_tdh-mbc_svuin
# id -nG | AWK OR SED
expected result: tdh_mbc_svuin


Looking to filter the ouput of id command on particular group that will always begins with tdh_mbc_ and there is only going to be exactly one.
$ id -nG
vqh_ub5 tdh-benjo pbl_tubogpse pbl_svuin tdh_dmvtufs_benjot tdh_dmvtufs_vtfst tdh_dmvtufs_bqqt tdh_mbc_svuin dmfbobjs_dmvtufs_vtfst tdh_httd_vtfst pbl_tdh-mbc_svuin
# id -nG | AWK OR SED
expected result: tdh_mbc_svuin