1
I have a text file looking something like this:
*FILESTART
line_a
line_b
line_c
*INCLUDE
file_A.key
file_B.key
*INCLUDE
file_1.key
file_2.key
file_3.key
*SOMETHING_ELSE
line_x
line_y
line_z
*END
I would like to print only the lines between each *INCLUDE statement and whatever asterisk statement that comes next, in this case the following:
file_A.key
file_B.key
file_1.key
file_2.key
file_3.key
The number of .key files can vary and the names does not always end with .key.
The code for this will be implemented in an existing bash script, so it should be based on awk, sed or something else in "bash style", not Perl, PHP, Python etc.
I have tried things like
sed -n '/^*INCLUDE/,/^\*/p'
but it only prints the first section and ends by the second *INCLUDE line.
Any suggestions?
That's amazing! Thank you Thor, god of awk. :-) – user325113 – 2014-05-20T10:46:12.463
@Ayodhya. Sorry about that. I'm new here. I've accepted Thor's answer now. Thank you for reminding me. – user325113 – 2014-05-20T11:20:05.083