tjbradford
Technical User
Hi all i am greping a file to obtain the hostname and ip address
cat file.txt |grep -e "hostname" >made.txt
cat file.txt |grep -e "ip address" >>made.txt
file then contains the following
hostname device-1
ip address 10.10.10.1
ip address 10.10.10.2
ip address 10.10.10.3
i would like it in this format ideally
hostname device-1 ip address 10.10.10.1
hostname device-1 ip address 10.10.10.2
hostname device-1 ip address 10.10.10.3
what magic do i need to do this?
I am looking to do this on a windows box really but with qgrep and gawk - if needs must tho i can do it on a linux box but the files are on dows at the moment.
any ideas
cat file.txt |grep -e "hostname" >made.txt
cat file.txt |grep -e "ip address" >>made.txt
file then contains the following
hostname device-1
ip address 10.10.10.1
ip address 10.10.10.2
ip address 10.10.10.3
i would like it in this format ideally
hostname device-1 ip address 10.10.10.1
hostname device-1 ip address 10.10.10.2
hostname device-1 ip address 10.10.10.3
what magic do i need to do this?
I am looking to do this on a windows box really but with qgrep and gawk - if needs must tho i can do it on a linux box but the files are on dows at the moment.
any ideas