3 edited tags
| link
2 formatting to make question readable
source | link

I have file file1.txt /file2.txt When I run the awk command with boundary search between "Type header call_header " and "END" it print the lines below END also . Example :-

File1.txt

File1.txt

Type header call_header abc , def , ghi , jkl ,mno END Define call_header type as call_header

Type header call_header 
abc , def , ghi , 
jkl ,mno 
END 
Define call_header 
type as call_header 

Fil2.txt

Fil2.txt

Type head call_header data1, data2, voice , mms , mms2 END Define call_header type as call_header

Type head call_header
data1, data2, voice ,
mms , mms2 
END
Define call_header 
type as call_header

awk '/^Type (header|head) call_header$/,/^END?$/'I have tried: {print} file1.txt .

awk '/^Type (header|head) call_header$/,/^END?$/'  {print} file1.txt

However, it is printing other lines also . Need

Need Below data only :-- Type header call_header abc , def , ghi , jkl ,mno END

Type header call_header 
abc , def , ghi , 
jkl ,mno 
END 

I have file file1.txt /file2.txt When I run the awk command with boundary search between "Type header call_header " and "END" it print the lines below END also . Example :-

File1.txt

Type header call_header abc , def , ghi , jkl ,mno END Define call_header type as call_header

Fil2.txt

Type head call_header data1, data2, voice , mms , mms2 END Define call_header type as call_header

awk '/^Type (header|head) call_header$/,/^END?$/' {print} file1.txt .

it is printing other lines also . Need Below data only :-- Type header call_header abc , def , ghi , jkl ,mno END

I have file file1.txt /file2.txt When I run the awk command with boundary search between "Type header call_header " and "END" it print the lines below END also . Example :-

File1.txt

Type header call_header 
abc , def , ghi , 
jkl ,mno 
END 
Define call_header 
type as call_header 

Fil2.txt

Type head call_header
data1, data2, voice ,
mms , mms2 
END
Define call_header 
type as call_header

I have tried:

awk '/^Type (header|head) call_header$/,/^END?$/'  {print} file1.txt

However, it is printing other lines also .

Need Below data only :

Type header call_header 
abc , def , ghi , 
jkl ,mno 
END 
1
source | link

awk to find the multiple pattern in a line

I have file file1.txt /file2.txt When I run the awk command with boundary search between "Type header call_header " and "END" it print the lines below END also . Example :-

File1.txt

Type header call_header abc , def , ghi , jkl ,mno END Define call_header type as call_header

Fil2.txt

Type head call_header data1, data2, voice , mms , mms2 END Define call_header type as call_header

awk '/^Type (header|head) call_header$/,/^END?$/' {print} file1.txt .

it is printing other lines also . Need Below data only :-- Type header call_header abc , def , ghi , jkl ,mno END