What I need to accomplish:
I want to recursively match everything from string1 to fixed_string (both included) on text_files and output the results onto a result_file.
My command is as follow:
sed -nf /path/to/patterns_file /path/to/lists/* > result_file
For instance:
- string1 in patterns is:
4321/14
. - fixed_string in patterns is:
------------------------------------------------------
The content of patterns_file is as following:
/\<4321\/14\>/,/------------------------------------------------------/p
/\<4319\/14\>/,/------------------------------------------------------/p
/\<5183\/14\>/,/------------------------------------------------------/p
/\<487\/08\>/,/------------------------------------------------------/p
/\<8767\/14\>/,/------------------------------------------------------/p
/\<8768\/14\>/,/------------------------------------------------------/p
/\<8769\/14\>/,/------------------------------------------------------/p
/\<10270\/01\>/,/------------------------------------------------------/p
/\<8354\/14\>/,/------------------------------------------------------/p
/\<8883\/14\>/,/------------------------------------------------------/p
/\<3978\/13\>/,/------------------------------------------------------/p
/\<6344\/13\>/,/------------------------------------------------------/p
/\<3882\/09\>/,/------------------------------------------------------/p
/\<8881\/14\>/,/------------------------------------------------------/p
/\<9913\/14\>/,/------------------------------------------------------/p
/\<6596\/13\>/,/------------------------------------------------------/p
My test_files are as following(located in lists directory)
JUZGADO_CIVIL_10_PRO_2014-10-24.TXT
JUZGADO_CIVIL_11_PRO_2014-10-24.TXT
JUZGADO_CIVIL_12_PRO_2014-10-24.TXT
JUZGADO_CIVIL_13_PRO_2014-10-24.TXT
JUZGADO_CIVIL_14_PRO_2014-10-24.TXT
JUZGADO_CIVIL_15_PRO_2014-10-24.TXT
JUZGADO_CIVIL_16_PRO_2014-10-24.TXT
JUZGADO_CIVIL_17_PRO_2014-10-24.TXT
JUZGADO_CIVIL_18_PRO_2014-10-24.TXT
JUZGADO_CIVIL_19_PRO_2014-10-24.TXT
JUZGADO_CIVIL_1_PRO_2014-10-24.TXT
JUZGADO_CIVIL_20_PRO_2014-10-24.TXT
JUZGADO_CIVIL_21_PRO_2014-10-24.TXT
JUZGADO_CIVIL_22_PRO_2014-10-24.TXT
JUZGADO_CIVIL_23_PRO_2014-10-24.TXT
JUZGADO_CIVIL_2_PRO_2014-10-24.TXT
JUZGADO_CIVIL_3_PRO_2014-10-24.TXT
JUZGADO_CIVIL_4_PRO_2014-10-24.TXT
JUZGADO_CIVIL_5_PRO_2014-10-24.TXT
JUZGADO_CIVIL_6_PRO_2014-10-24.TXT
JUZGADO_CIVIL_7_PRO_2014-10-24.TXT
JUZGADO_CIVIL_8_PRO_2014-10-24.TXT
JUZGADO_CIVIL_9_PRO_2014-10-24.TXT
JUZGADO_NOTARIAL_PRO_2014-10-24.TXT
The content of one txt
file uploaded here: get JUZGADO_CIVIL_18_PRO_2014-10-24.TXT
The rest of the files are similar to this one.
The problem is that when there is another matching expression between string1
and fixed_string
I get duplicated or triplicated lines as output, like this:
[...output omitted...]
Expte. N°: 8769/14 -Foja: 9- JARA MELAGRANI, DIEGO
C/MUNICIPALIDAD DE RESISTENCIA S/EJECUCION DE HONORARIOS -
estesestese
CARLOS D. LUGON
-Abogado Secretario -
Juzgado Civil y Comercial Nº 18
"2014 Año de la concordia, el diálogo y la paz - S.S. Francisco"
Expte. Nº 8769/14 - MMMN
Resistencia, 20 de octubre de 2014.
Téngase al Dr. DIEGO JARA MELAGRANI por presentado, parte,
con el patrocinio letrado del Dr. MAURO DANIEL FOGLIATTI, con domicilio
legal constituido, dándosele en autos la intervención que por derecho
corresponda. A lo demás, estése a lo resuelto en el Expte.Nº 8768/14 que
corresponda. A lo demás, estése a lo resuelto en el Expte.Nº 8768/14 que
corre por cuerda.- NOT.-
corre por cuerda.- NOT.-
OMAR A. MARTINEZ
OMAR A. MARTINEZ
- Juez -
- Juez -
Juzgado Civil y Comercial Nº 18
Juzgado Civil y Comercial Nº 18
NOTA DE SECRETARIA:
NOTA DE SECRETARIA:
Se deja constancia que a fs.12/13 del Expte.Nº
Se deja constancia que a fs.12/13 del Expte.Nº
8768/14 caratulado "JARA MELAGRANI, DIEGO C/ MUNICIPALIDAD DE RESISTENCIA
8768/14 caratulado "JARA MELAGRANI, DIEGO C/ MUNICIPALIDAD DE RESISTENCIA
S/ EJECUCION DE HONORARIOS", se ha ordenado la acumulación de la presente
S/ EJECUCION DE HONORARIOS", se ha ordenado la acumulación de la presente
causa a aquellos actuados.- CONSTE. SECRETARIA, 20 de octubre de 2014.-
causa a aquellos actuados.- CONSTE. SECRETARIA, 20 de octubre de 2014.-
[...output omitted...]
------------------------------------------------------
[...output omitted...]
Here for instance, there is '8768/14' between
'8769/14' and '------------------------------------------------------'.
If it's not clear what I want to achieve or what the problem is, I can try to further clarify the issue.
How can fix that problem? Is there a better and more efficient solution to this?