Skip to main content
se eliminaron 9 caracteres en el cuerpo; etiquetas editadas; título editado
Origen Enlace
fedorqui
  • 16.7k
  • 24
  • 71
  • 134

Obtener solo una parte de un stringuna cadena en bashBash

-- 2019-04-28 07:05:06.538818 [73589] [73589] Running 200 out of 214 commands: analyze schema_owner."nombre_tabla_mala"

-- 2019-04-28 07:05:06.538818 [73589] [73589] Running 200 out of 214 commands: analyze schema_owner."nombre_tabla_mala"

¿Cómo podría desechar el resto de la cadena?

EDITO--

Obtener solo una parte de un string en bash

-- 2019-04-28 07:05:06.538818 [73589] [73589] Running 200 out of 214 commands: analyze schema_owner."nombre_tabla_mala"

¿Cómo podría desechar el resto de la cadena?

EDITO--

Obtener solo una parte de una cadena en Bash

-- 2019-04-28 07:05:06.538818 [73589] [73589] Running 200 out of 214 commands: analyze schema_owner."nombre_tabla_mala"

¿Cómo podría desechar el resto de la cadena?

Ampliación de código
Origen Enlace
lk2_89
  • 607
  • 10
  • 29

EDITO--

Pongo las primeras veinte líneas del fichero log en cuestión:

-- 2019-04-28 05:54:53.830738 [73589] [73589] Running 1 out of 1 commands: set wlm_query_slot_count = 4
-- 2019-04-28 05:54:53.833469 [73589] Success.
-- 2019-04-28 05:54:53.833531 [73589] [73589] Running 1 out of 1 commands: set statement_timeout = '36000000'
-- 2019-04-28 05:54:53.836162 [73589] Success.
-- 2019-04-28 05:54:53.836190 [73589] [73589] Running 1 out of 1 commands: set application_name to 'AnalyzeVacuumUtility-v.9.1.6'
-- 2019-04-28 05:54:53.838700 [73589] Success.
-- 2019-04-28 05:54:53.838788 [73589] Extracting Candidate Tables for Vacuum...
-- 2019-04-28 05:55:57.850685 [73589] Found 0 Tables requiring Vacuum and flagged by alert
-- 2019-04-28 05:55:57.850795 [73589] Extracting Candidate Tables for Vacuum ...
-- 2019-04-28 05:56:34.908067 [73589] Found 107 Tables requiring Vacuum due to stale statistics
-- 2019-04-28 05:56:34.908263 [73589] [73589] Running 1 out of 214 commands: vacuum FULL schema_owner."t_ed_p" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:56:47.588342 [73589] Success.
-- 2019-04-28 05:56:47.588401 [73589] [73589] Running 2 out of 214 commands: analyze schema_owner."t_ed_p"
-- 2019-04-28 05:56:50.363655 [73589] Success.
-- 2019-04-28 05:56:50.363711 [73589] [73589] Running 3 out of 214 commands: vacuum FULL schema_owner."t_ed_p_estados" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:57:03.430064 [73589] Success.
-- 2019-04-28 05:57:03.430124 [73589] [73589] Running 4 out of 214 commands: analyze schema_owner."t_ed_p_estados"
-- 2019-04-28 05:57:06.024933 [73589] Success.
-- 2019-04-28 05:57:06.025023 [73589] [73589] Running 5 out of 214 commands: vacuum FULL schema_owner."t_ed_p_tps_actividad" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:57:06.024933 [73589] Success.

Yo al final lo que necesito obtener es el schema y la tabla. Es decir, de las que salen en este ejemplo, necesitaría enviar al fichero .csv lo siguiente:

schema_owner."t_ed_p"
schema_owner."t_ed_p_estados"
schema_owner."t_ed_p_tps_actividad"

EDITO--

Pongo las primeras veinte líneas del fichero log en cuestión:

-- 2019-04-28 05:54:53.830738 [73589] [73589] Running 1 out of 1 commands: set wlm_query_slot_count = 4
-- 2019-04-28 05:54:53.833469 [73589] Success.
-- 2019-04-28 05:54:53.833531 [73589] [73589] Running 1 out of 1 commands: set statement_timeout = '36000000'
-- 2019-04-28 05:54:53.836162 [73589] Success.
-- 2019-04-28 05:54:53.836190 [73589] [73589] Running 1 out of 1 commands: set application_name to 'AnalyzeVacuumUtility-v.9.1.6'
-- 2019-04-28 05:54:53.838700 [73589] Success.
-- 2019-04-28 05:54:53.838788 [73589] Extracting Candidate Tables for Vacuum...
-- 2019-04-28 05:55:57.850685 [73589] Found 0 Tables requiring Vacuum and flagged by alert
-- 2019-04-28 05:55:57.850795 [73589] Extracting Candidate Tables for Vacuum ...
-- 2019-04-28 05:56:34.908067 [73589] Found 107 Tables requiring Vacuum due to stale statistics
-- 2019-04-28 05:56:34.908263 [73589] [73589] Running 1 out of 214 commands: vacuum FULL schema_owner."t_ed_p" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:56:47.588342 [73589] Success.
-- 2019-04-28 05:56:47.588401 [73589] [73589] Running 2 out of 214 commands: analyze schema_owner."t_ed_p"
-- 2019-04-28 05:56:50.363655 [73589] Success.
-- 2019-04-28 05:56:50.363711 [73589] [73589] Running 3 out of 214 commands: vacuum FULL schema_owner."t_ed_p_estados" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:57:03.430064 [73589] Success.
-- 2019-04-28 05:57:03.430124 [73589] [73589] Running 4 out of 214 commands: analyze schema_owner."t_ed_p_estados"
-- 2019-04-28 05:57:06.024933 [73589] Success.
-- 2019-04-28 05:57:06.025023 [73589] [73589] Running 5 out of 214 commands: vacuum FULL schema_owner."t_ed_p_tps_actividad" ; /* Size : 120 MB,  Unsorted_pct : N/A */ ;
-- 2019-04-28 05:57:06.024933 [73589] Success.

Yo al final lo que necesito obtener es el schema y la tabla. Es decir, de las que salen en este ejemplo, necesitaría enviar al fichero .csv lo siguiente:

schema_owner."t_ed_p"
schema_owner."t_ed_p_estados"
schema_owner."t_ed_p_tps_actividad"
Origen Enlace
lk2_89
  • 607
  • 10
  • 29
Loading