A file contains a few thousand lines in the following format:
hostname1
Set: domainname
hostname2
Set: domainname
hostname3
hostname4
hostname5
Set: domainname
hostname6
-bash:
hostname7
hostname8
-bash
What I want is:
if the line below hostname is 'Set' then:
hostname: domainname
if the line below hostname is '-bash' then:
hostname: not found
if the line contains only hostname then:
hostname: no login
So from the above the output would be:
hostname1: domainname
hostname2: domainname
hostname3: no login
hostname4: no login
hostname5: domainname
hostname6: not found
hostname7: no login
hostname8: not found
hostname1
Set: domainname
hostname2
Set: domainname
hostname3
hostname4
hostname5
Set: domainname
hostname6
-bash:
hostname7
hostname8
-bash
What I want is:
if the line below hostname is 'Set' then:
hostname: domainname
if the line below hostname is '-bash' then:
hostname: not found
if the line contains only hostname then:
hostname: no login
So from the above the output would be:
hostname1: domainname
hostname2: domainname
hostname3: no login
hostname4: no login
hostname5: domainname
hostname6: not found
hostname7: no login
hostname8: not found