
Tengo los siguientes datos aleatorios enormes.
1231286234|453|1234|xxx|aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx| aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx |aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx | aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
las líneas son enormes y los datos son aleatorios, quiero que sean como
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
Respuesta1
Esto funciona para la muestra que ha proporcionado.
Find what: (\w*\|\w*\|\w*\|\w*)([\|\s]*)([\w\|]*)
Replace with: \1 \3
Search mode: Regular expression
Respuesta2
- Ctrl+H
- Encontrar que:
^(?:[^|]+\|){3}.*?\K\h*\|\h*
- Reemplazar con:
<-- un espacio
- CONTROLAR Envolver alrededor
- CONTROLAR Expresión regular
- DESMARCAR
. matches newline
- Replace all
Explicación:
^ # beginning of line
(?: # start non capture group
[^|]+ # 1 or more non pipe
\| # a pipe, have to be escaped as it's special character for regex
){3} # end group, must appear 3 times
.*? # 0 or more any character but new line, not greeedy
\K # forget all we have seen until this position
\h* # 0 or more horizontal spaces
\| # a pipe, have to be escaped as it's special character for regex
\h* # 0 or more horizontal spaces
Captura de pantalla (antes):
Captura de pantalla (después):