Hi,
I am capturing command's output on remote host using Expect. The problem is that the command line arguments also getting print with the output in file and also need to print last two relevant columns (percentage used and its mounted point).
The output of $exp->before() buffer is :
df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 4063064 8 4063056 1% /dev
tmpfs 4074272 0 4074272 0% /dev/shm
tmpfs 4074272 141132 3933140 4% /run
tmpfs 4074272 0 4074272 0% /sys/fs/cgroup
/dev/sda1 20510332 15487436 3974372 80% /
/dev/sdb1 10189112 964776 8700100 10% /var/log
tmpfs 814856 0 814856 0% /run/user/107
tmpfs 814856 0 814856 0% /run/user/0
I need following output. Deleted first line (df) and only last two columns interchanged:
Mounted on Use%
/dev 1%
/dev/shm 0%
/run 4%
/sys/fs/cgroup 0%
/ 80%
/var/log 10%
/run/user/107 0%
/run/user/0 0%
Thanks