Hi all,
I have little working knowledge in unix shell scripting. I have a requirement where i need to pull out some data in between the strings in the file.
Input:
TEST
a
a
c
f
d
TEST
f
e
g
g
TEST
Output:
a
a
c
f
d
f
e
g
g
Could anyone help me in this please.
You want to extract the data between TEST and TEST pairs? If so, what about the next TEST?
--ahamed
Yes. I need to read the data between the TESTs and pull out some information.
There will be may TESTs in the file..So, till the last TEST, i need to do this
So, you just want to suppress TEST and print the data? I guess NOT
#input
TEST
a
b
c
TEST
1
2
3
TEST
d
e
f
TEST
#output
a
b
c
d
e
f
Like this? will there be even number of TEST in your file to define the boundary?
--ahamed
No. I don't want to suppress. Based on the boundaries (TEST), i should again loop the line and pull some data (with grep etc..).
No. I will not have any clue how many TESTs i will have. May, be we can achieve the number of TESTs we have in the file if we need the boundary limit.
Post a valid input file and expected output and we can work it out!
--ahamed
Based on your input and output, the below line should achieve what you want.
grep -v "TEST" input.txt
my requirement is not to exclude the TEST string