gpt4 book ai didi

linux - grep 键值对和格式的值

转载 作者:太空宇宙 更新时间:2023-11-04 11:41:27 25 4
gpt4 key购买 nike

当我执行以下操作时

ps -aef|grep "asdf" 

我得到了正在运行的进程列表。我的每个过程在输出中都有以下文本:

-ProcessName=XXXX

我希望能够格式化输出,所以我得到的是:

The following processes are running:
Process A
Process B
etc..

最佳答案

使用sed(1):

... | grep "asdf" | sed -e 's:.*-ProcessName=\([^ ]\+\).*:Process \1:'

关于linux - grep 键值对和格式的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2493795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com