Estoy usando el siguiente comando para extraer descripciones de parches:
sed '
s/Title: \(.*\)/### \1 ###\n\n**File:** FILE_NAME_HERE/
/^diff\|^---/ {
q
}
' "$patch" | egrep -v '^(diff|---)'
¿Cómo puedo deshacerme de la egrep -v '^(diff|---)'
parte y solo uso sed? Intenté hacer esto:
/^diff\|^---/ {
d # <-- This is what I added
q
}
Pero una vez que se alcanza la "d", la "q" se omite y el resto de las líneas en el cuerpo del parche se imprimen. Aquí hay un parche de muestra:
Title: Font Array Support
Modifies st to support user-defined fallback fonts specified in an array
defined as `static const char *fonts[]`. This change also resolves an issue
where fallback fonts were used in place of default fonts in an inconsistent
manner which caused identical sets of text to sometimes use different fonts. In
the following example, DejaVu Sans Mono is the primary font with two others
specified as fallbacks:
static const char *fonts[] = {
"DejaVu Sans Mono",
"VL Gothic",
"WenQuanYi Micro Hei",
};
diff --git a/st.c b/st.c
index 2594c65..f7973bd 100644
--- a/st.c
+++ b/st.c
@@ -353,10 +353,17 @@ typedef struct {
FcPattern *pattern;
} Font;
El script sed debe devolver todo lo que está arriba de la línea que comienza con "diff"; esto es lo que debería ser la salida:
Title: Font Array Support
Modifies st to support user-defined fallback fonts specified in an array
defined as `static const char *fonts[]`. This change also resolves an issue
where fallback fonts were used in place of default fonts in an inconsistent
manner which caused identical sets of text to sometimes use different fonts. In
the following example, DejaVu Sans Mono is the primary font with two others
specified as fallbacks:
static const char *fonts[] = {
"DejaVu Sans Mono",
"VL Gothic",
"WenQuanYi Micro Hei",
};