Script needed!! - Please help

Hi All,

I have a text file contains the follwoing info:

HOST_CONFIG spbf1n01 3181 patrolpv "B6abbKEW5L1TCE5B282445" I E W A
HOST_CONFIG spbf1n02 3181 patrolpv "B6abbKEW5L1TCE5B282445" I E W A
HOST_CONFIG spbf1n03 3181 patrolpv "B6abbKEW5L1TCE5B282445" I E W A

Whenever the String "HOST_CONFIG" matches then it needs to print the next word into a new file. Finally new file needs to have like,

spbf1n01
spbf1n02
spbf1n03

Please give me a script to achive my reuirement.

Thanks in advance,
Gobinathan.S

A quick search of your posting history shows the same thing over and over....

give me the code I don't want to do any work here are my requirements now do it for me

a simple "grep" and "cut" should do the job... show us what you've done so far and maybe we can give you a hint...

If the word "HOST_CONFIG" will alwasy come in the beginning you can use below command

grep "^HOST_CONFIG" File_Name |cut -d' ' -f2

Otherwise below awk command will do

awk '{for(i=0;i<=NF;i++) if($i=="HOST_CONFIG") print $(i+1)}' File_Name

Dear Gobinathan,

This is not a forum of people with a purpose to do your work for you.

If you want to post here, you need to do the work yourself, post the code you write, and then ask for help with problems you might be having.

However, please do your own work, post the code you have written, and then ask folks for help debugging problems you might have.

Thank you.

Hi Kevin,

I am rarely using the scripting part, It is nearly a year after I am posting for my requirement.

My job profile needs scripting very very rare. I parepared set of script and need this particular info to append on it. This particular info which I dont know.

Thanks for your info, It's bit hurted on me and will try to learn the scripting part asap.

Thanks

awk '$1 ~/HOST_CONFIG/ {print $2}' input_file.txt