Linux 如何删除“;注:";在命令结果之前到达?
我正试图通过下面的命令使tomcat服务在我的linux系统中运行 chkconfig--list | grep-i on | sed-n'/tomcat/p'| awk'{print$1}' 我得到的结果是Linux 如何删除“;注:";在命令结果之前到达?,linux,shell,tomcat,networking,grep,Linux,Shell,Tomcat,Networking,Grep,我正试图通过下面的命令使tomcat服务在我的linux系统中运行 chkconfig--list | grep-i on | sed-n'/tomcat/p'| awk'{print$1}' 我得到的结果是 Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by nat
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
tomcat9
我只想得到服务名,即“tomcat9”。我需要在命令中做什么更改?添加此
awk
过滤器:
|awk -v skip=-1 '/^Note:/{skip=7} skip-- >= 0{next} 1'
如果第一行中的第一个单词是“Note:”,则跳过七行。可能是其他行显示在
stderr
?是的,stderrchkconfig--list 2>/dev/null
将它们取出。它正在工作。。但是chkconfig--list 2>/dev/null命令的后果是什么呢chkconfig--list 2>/dev/null | grep-i on | sed-n'/tomcat/p'| awk'{print$1}'