in bash shell: 提取命令的部分输出并输出到文件
in bash shell: extract part of the output of a command and output to file
假设我 运行 "mount" 在 Bash,我得到这样的结果:
--]$mount
/dev/disk1 on / (journaled)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
//user@server/share on ***/user/share*** (afpfs, mounted ***by user***)
从 "mounted by user" = 'someUser' 的行我想输出到本地安装点路径“/user/share”的文件部分。
对于匹配 "mounted by" 的行,打印第 3 列:
mount | awk '/mounted by / { print }'
假设我 运行 "mount" 在 Bash,我得到这样的结果:
--]$mount
/dev/disk1 on / (journaled)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
//user@server/share on ***/user/share*** (afpfs, mounted ***by user***)
从 "mounted by user" = 'someUser' 的行我想输出到本地安装点路径“/user/share”的文件部分。
对于匹配 "mounted by" 的行,打印第 3 列:
mount | awk '/mounted by / { print }'