Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Last active November 14, 2017 09:31
Show Gist options
  • Save verajosemanuel/531454e27be49d4cb3b70e27433f4579 to your computer and use it in GitHub Desktop.
Save verajosemanuel/531454e27be49d4cb3b70e27433f4579 to your computer and use it in GitHub Desktop.
#perl inserts a newline between negative + positive #regex pattern in #bash
perl -pe 's/NOTNEEDED\.\s*WORD(*SKIP)(*F)|WORD\./\n$&/g'
# SAMPLE
NOTNEEDED. WORD. 8 de 2007/04/12 excepción definitiva
1ª Concesión de derechos en Londres WORD. 3901 de 2019/10/01 UTC
# OUTPUT
NOTNEEDED. WORD. 8 de 2007/04/12 excepción definitiva
1ª Concesión de derechos en Londres
WORD. 3901 de 2019/10/01 UTC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment