- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我需要在 Linux (RHEL 4/5) 和 Solaris (Solaris 10) 系统上使用 mount
提取 NFS 挂载信息。由于这是 SSH 命令的一部分,因此提取需要在一行中进行。不幸的是,Linux 和 Solaris 在该行的不同部分显示挂载点:
Linux:
10.0.0.1:/remote/export on /local/mountpoint otherstuff
索拉里:
/local/mountpoint on 10.0.0.1:/remote/export otherstuff
我想得到以下空格分隔的输出
10.0.0.1 /remote/export /local/mountpoint
我设法用 sed
(Solaris 10 sed
) 单独完成它,但我需要一个命令为两者返回相同的输出。
Linux sed
:
sed 's/\([^:]*\):\([^ ]*\)[^\/]*\([^ ]*\) .*/\1 \2 \3/'
Solaris sed
:
sed 's/\([^ ]*\) *on *\([^:]*\):\([^ ]*\) .*/\2 \3 \1/'
解决方案:
我改编了accepted answer还可以使用 DNS 名称而不仅仅是 IP:
awk -F'[: ]' '{if(/^\//)print $3,$4,$1;else print $1,$2,$4}'
最佳答案
awk 可以帮助您:
awk -F'[: ]' '{if(/^[0-9]/)print $1,$2,$4;else print $3,$4,$1}'
查看此测试:
kent$ cat f
10.0.0.1:/remote/export on /local/mountpoint otherstuff
/local/mountpoint on 10.0.0.1:/remote/export otherstuff
kent$ awk -F'[: ]' '{if(/^[0-9]/)print $1,$2,$4;else print $3,$4,$1}' f
10.0.0.1 /remote/export /local/mountpoint
10.0.0.1 /remote/export /local/mountpoint
关于linux - 如何从 Linux 和 Solaris 上的挂载中提取 NFS 信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20974140/
我正在运行 Debian GNU/Linux 7 VM mount.nfs 版本 mount.nfs: (linux nfs-utils 1.2.6) 我想在 NFS 挂载上设置配额。 NFS 服务器
我正在尝试使用 VirtualBox 作为提供程序并使用 ansible 作为配置工具来“升级”一台 CentOS 机器 (centos7-x64-vbox43)。我执行了以下命令: vagrant
我最近使用 inotify 创建了一个保管箱系统,监视在特定目录中创建的文件。我正在监视的目录是从 NFS 服务器挂载的,并且 inotify 的行为与我的预期不同。考虑以下场景,其中 inotify
我已经在我的本地机器上安装了一个 NFS 挂载(所以,我想我的机器是 NFS 客户端)并且一个文件正在被托管 NFS 挂载的远程机器(NFS 服务器)写入 NFS 挂载中。现在,我如何使用 JAVA
我关注这个tutorial为我的服务器设置 NFS。目前,我有 1 台服务器将其部分目录共享为 HOST,2 台服务器将这些目录作为 CLIENT。 我的问题很直接,如果我的HOST包含200万张图片
我在主机上有一个 NFS 分区,如果将其添加到容器中 docker run -i -t -v /srv/nfs4/dir:/mnt ubuntu /mnt 将包含共享数据,但它不会导致冲突吗?因为它还
没有 iptables 规则,我可以挂载我的 NFSSERVER:/PATH 但有了它(firewall/iptables) 已启用,但我无法安装。 [.e.g., after iptables --
我们有两个数据中心,每个数据中心都有许多共享一个基于 EMC 的大型 nfs 的 Linux 服务器。 挑战在于保持两个 nfs 同步。目前假设写入仅发生在 nfs1 上,然后 nfs1 必须将更改传
我在尝试挂载 nfs 导出时遇到以下错误。 sudo mount 192.168.1.175:/mnt/nas /mnt/c/nas mount.nfs: No such device 关于如何解
NFS 挂载在我的 RHEL 7 AWS 实例中不起作用。 当我做一个 mount -o nfsvers=3 10.10.11.10:/ndvp2 /root/mountme2/ 我得到错误: mou
我正在复制 Controller 示例 [1] 中尝试 Kubernetes NFS 卷声明。 我已经设置了 NFS 服务器、PV 和 PVC。我的复制 Controller 看起来像这样 apiVe
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我想查找并更改用户帐户及其在本地文件系统上的默认组,但不包括大量 NFS 安装和指向这些安装的符号链接(symbolic link)。我尝试了多种语法但没有成功 - find / -user dumm
我正在使用 docker NFS 容器,但是在安装导出的目录(即使在本地主机上)时遇到了麻烦。 问题 exportfs: does not support NFS export 设置 我的容器使用入
HDFS NFS GateWay mount.nfs:输入/输出错误? 1.报错如下: [root@xx sbin]# mount -t nfs -o vers=3,proto=tcp,nolock,
我无法为 Docker Swarm 安装 NFS 卷,并且缺乏有关 --mount 语法( https://docs.docker.com/engine/reference/commandline/s
我有一个 Kubernetes 集群设置(本地),它有一个 NFS 共享(my-nfs.internal.tld)安装到 /exports/backup在每个节点上创建备份。 现在我正在设置我的日志记
我想将 sqlite 数据库嵌入到现有的 tcl 应用程序中(从平面文件迁移)。 目前;我们的 tcl 解释器是从网络位置运行的; /bin/tclsh8.3 我有一个 nfs $PATH对于已经为所
我在一台服务器上为客户端创建了一个 NFS 共享服务器和客户端都是centos 6系统。服务器 nfs 导出:/srv/diskless/tmp *(rw,sync,no_root_squash)。
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 10 个月前关闭。 Improve
我是一名优秀的程序员,十分优秀!