I have a file called data.txt. when I read the file, the content looks like the below.
$ cat data.txt
name: linuxVol
id: 6
type: Linux
dir excludes: .snapshot*
~snapshot*
.zfs
.isilon
.ifsvar
.lustre
inode: 915720
free_space: 35.6TiB (auto)
total_capacity: 95.0TiB (auto)
number_of_files: 5,789,643
number_of_dirs: 520,710
mounts: https://server1.example.com:30002: /mnt/tube
How can I extract keywords Linux from the third line and server1.example.com from the last line and then represent them in the same line separated by space? The output should show something like below
Linux server1.example.com
I tried to do something like this but not sure how could I extract server1.example.com
cat data.txt | egrep "type|mounts" | awk '{print $NF}' | tr "\n" " "
output was:
Linux /mnt/tube
My expected output:
Linux server1.example.com
Solving it with AWK/SED will work for me.
Thank you!