Hi,
- In a file test.wmi
Col1 | firstName | lastName
4003 | toto_titi_CT- | otot_itit
- I want to have only ( colones $7,$13 and $15) with code
4003
and4002
. for colone $13 I want to have the whole name untill_CT-
or_GC-
1- I used the command egrep
with awk
#egrep -i "EventID=4002|EventID=4003" test.wmi |awk -F '[=|<|>]' '{print $7, substr($13,1,38),$15 }'
file out:
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As st_assurnet_controleMSG_decompte_rejet_AMO:
4003 SAVKHE_SV_SAVJ_GC_ALICIA_RH_SAUVEGARDE lance_tina:
4003 ASSNET_ST_CYCLIQUE expl_st_pilot_export:
4003 ASSNET_ST_CYCLIQUE expl_st_cftenv:
4003 GTWPRD_FT_Assurnet_controle_flux CT-Assurnet_controle_flux:
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As Put_Fichier_Decompte_AMC:
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As Put_Fichier_Assure_AMC:
2- I used sed
to avoid the :
in the end of 3rd colone
[tmp]# egrep -i "EventID=4002|EventID=4003" test.wmi |awk -F '[=|<|>]' '{print $7, substr($13,1,38),$15 }' | sed 's/:[ \t]*//'
file out-
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As st_assurnet_controleMSG_decompte_rejet_AMO
4003 SAVKHE_SV_SAVJ_GC_ALICIA_RH_SAUVEGARDE lance_tina
4003 ASSNET_ST_CYCLIQUE expl_st_pilot_export
4003 ASSNET_ST_CYCLIQUE expl_st_cftenv
4003 GTWPRD_FT_Assurnet_controle_flux CT-Assurnet_controle_flux
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As Put_Fichier_Decompte_AMC
4003 GTWPRD_FT_Assurnet_controle_flux_CT-As Put_Fichier_Assure_AMC
- in the case i Have a name with
_CT-"GTWPRD_FT_Assurnet_controle_flux_CT-As"
i want only have the name before_CT- " GTWPRD_FT_Assurnet_controle_flux"
Can someone help me to find the command to do this
thks
georg