I need to read from a file and find a word in it. The file is generated new each time my script is run. The file has many lines in it, but there is always one unique line which has the following:
INSTANCE i-cbea4fa5 ami-c3e4dda ec2-........
The values “INSTANCE” and “ami-c3e4dda” will always be the same in the file. The second item, “i-cbea4fa5” will vary but will always be in the same location within that line, and will always begin with “i-“.
I need to find and then use the “i-cbea4fa5” value in a script.
1) how can I pull out just that “i-cbea4fa5” value?
2) once found, what is the best way to use it?
Thank you,
Daniel Williams
1 Answer