reading a txt file
Lets say i have a text file named test.txt
It contains
ABC A 123
ABC A 456
ABC A 789
HET A 123
HET A 123
HET A 567
ABC A 123
ABC A 565
ABC A 123
TER
ABC B 123
ABC B 456
ABC B 789
HET B 123
HET B 123
HET B 567
ABC B 123
ABC B 565
ABC B 123
TER
HET 123
HET 123
HET 678
Is there a way for linux to print all the lines between ABC A and TER(Lines 1-10) on this case ?
The file is dynaminc, some files might have a 100 lines and some might have just 5. so head doesnt work. The problem is i dont know the lines where ABC A or TER exists. I am making a php script read the file with a system command. All i know is the first 5 characters which are "ABC A". Linuc should read the file when it reads this and stop reading when it hits the first TER after the ABC A
Any command to do this? Can you use head and tail with a string instead of a file name?
|