Well, when XPIC is enabled and Autorestore in NOT Enabled (in the example is Unknown but could be something else like "Disabled"), I have to take the related slot number to create a specified command (to execute it later).
So in the above example, slot 2:
XPIC is enabled and Autorestore is Uknown
Create outut command like: rl 2 xpicrecovery 5 5 (where 2 is the slot number)
Same for slot 3
XPIC is enabled and Autorestore is Uknown
Create outut command like: rl 3 xpicrecovery 5 5 (where 3 is the slot number)
Slot 4:
XPIC is disable (no autorestore variable present)
Just skip.....
Although Peasant's proposal delivers the desired output, it doesn't check the XPIC status but, if disabled, relies upon the missing Autorestore entry and silently discards the XPIC status.
We need more to start analysing. Is it possible your input has quirks? Show your OS and awk versions, commands / scripts, input data (maybe a hexdump of a few lines?), and error messages. Print $1 and $2 of your input data.
Please, review how you have executed the code from post #4. Based on your input it should have given you the desired output instead of no output as you mentioned.
Here's another iteration
awk '
$1 == "Slot" { slot = $2 # I am in record that starts the block
next } # move on to next line
$1 == "XPIC" { Xstatus = $2 # I am in record that contains XPIC
next } # nothing else, move on to read next line
$1 == "Autorestore" && # I am in record that ends block
Xstatus == "Enabled" && # do I need to print?
$2 != "Enabled" { print "rl", slot, "xpicrecovery 5 5" } # yes, I do print
' example.file
RudiC, don't misunderstand me, when I wrote "asap" I didn't want to speed up people to reply, just to say that I have a problem to solve
By the way, I solved the mistery, and you're right RudiC, my input has quirks, maybe because is coming from telnet, so I fixed it with:
dos2unix -a get.tmp > /dev/null 2>&1
Thank you all for collaboration, and for the many examples provided!!!