title: How grep and replace String in Csv file?
body: <p>Please, can you help me, I am a beginner in powershell and I have a csv file, I want to select the column &quot;Script or expected file(s)&quot;:</p>
  <ol>
  <li>delete these different characters (P or A or Xor C or L or D) at the beginning of the string ( example PWEBX-107Q-040T.BAT to get WEBX-107Q-040T.BAT) ,</li>
  <li>delete the first hyphen that is in the strings of this column (for example WEBX-107Q-040T.BAT to obtain WEBX107Q-040T.BAT) if the string begins with one of these patterns 'WEBX', 'DWHS', 'COGN', 'CLOT', 'CLAI', 'BTRE', 'BISI', 'BDDO', 'ARXL', 'AGSO', 'AGPC', 'ACTO', 'FNET' ,</li>
  <li>otherwise I don't delete the dash.</li>
  <li>Delete the dot with the extension (for example .KSH or .BAT ) whatever the value of the column of &quot;Script or expected file(s)</li>
  <li>replace the value in the column &quot;Jobstream&quot; by the value of &quot;&quot;Script or expected file(s)&quot; after the above modifications.</li>
  </ol>
  <p>Whatever the length of the word, my goal is to remove the first dash.      this is a csv file :</p>
  <pre><code>Jobstream;JobstreamDescription; Op num; Job;Script or expected file(s); Server; user;   location;   Job Description ; FIELD10
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;9;        ;technical;;;;Begin Of JobStream;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;50;PREXX0AB;PREXX-998Q-010M.BAT;PRAXCINTREXX01; AXA-CESSIONS\SVC_SCHEDULING;F+REXX-001;Arr�t Service Applicatif;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;60;PREXX0AC;PREXX-998Q-015M.BAT;PRAXCINTREXX01; AXA-CESSIONS\SVC_SCHEDULING;F+REXX-001;Arr�t Base;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;70;PREXX0AD;PREXX-998Q-020S.KSH;SELOPRSSPSRVC01; lin-sb-axausr;F+REXX-002;Sauvegarde;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;80;PREXX0AE;PREXX-998Q-025M.BAT;PRAXCINTREXX01; AXA-CESSIONS\SVC_SCHEDULING;F+REXX-001;D{marrage Base;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;90;PREXX0AF;PREXX-998Q-030M.BAT;PRAXCINTREXX01; AXA-CESSIONS\SVC_SCHEDULING;F+REXX-001;D{marrage Appli;02h00
  PAXCREXX998Q;BackUp (x)AXCINTREXX01;255;        ;technical;;;;End Of JobStream;02h00
  PAXCSHINTRGAAA;WAIT TRGFIC-SHIN001;9;        ;\REINSURANCE_DATA\client\01-Sources\*.xlsx;;;;START;
  PAXCSHINTRGAAA;WAIT TRGFIC-SHIN001;10;PSHINAAB;technical;;;;ADDJOBSTREAM;
  PAXCSHINTRGAAA;WAIT TRGFIC-SHIN001;255;        ;technical;;;;END;
  PAXCSHINTRGAAB;WAIT TRGFIC-SHIN003;9;        ;\prod\SHIN\data\in\PSHIN004\*.zip;;;;START;
  PAXCSHINTRGAAB;WAIT TRGFIC-SHIN003;10;PSHINAAD;technical;;;;ADDJOBSTREAM;
  PAXCSHINTRGAAB;WAIT TRGFIC-SHIN003;255;        ;technical;;;;END;
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;9;        ;technical;;;;Begin Of JobStream;00h30
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;40;PSHIN0AE;PSHIN-100Q-040D.BAT;PRAXCCLAIMAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-004;Extract du fichier SUSI;00h30
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;50;PSHIN0AF;PSHIN-100Q-050T.BAT;PRAXCCLAIMAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-004;Arch  prepa pour UDM;00h30
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;55;PSHIN0AG;PSHIN-100Q-055T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-002;Compression du fichier;00h30
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;60;PSHIN0AH;PSHIN-100Q-060T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;Trsft UDM shine;00h30
  PAXCSHIN100Q;Trsfrt SusiClaims  Shine;255;        ;technical;;;;End Of JobStream;00h30
  PAXCSHIN200Q;Extrat webxl + trsf SHIN;9;        ;technical;;;;Begin Of JobStream;00h30
  PAXCSHIN200Q;Extrat webxl + trsf SHIN;40;PSHIN0AI;PSHIN-200Q-040D.KSH;PRAXCWBXLBDD01; svc_bddo_user;F+SHIN-005;export des tables en csv;00h30
  PAXCSHIN200Q;Extrat webxl + trsf SHIN;45;PSHIN0AJ;PSHIN-200Q-045T.KSH;PRAXCWBXLBDD01; svc_bddo_user;F+SHIN-005;Zip et mise a dispo UDM;00h30
  PAXCSHIN200Q;Extrat webxl + trsf SHIN;50;PSHIN0AK;PSHIN-200Q-050T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;Udm tsfert to PRAXCAPP02;00h30
  PAXCSHIN200Q;Extrat webxl + trsf SHIN;255;        ;technical;;;;End Of JobStream;00h30
  PAXCSHIN210D;Transfert UDM shine;9;        ;technical;;;;Begin Of JobStream;
  PAXCSHIN210D;Transfert UDM shine;40;PSHIN0AL;PSHIN-210D-040T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;UDM PRAXCAPP02 =&gt; SHINE;
  PAXCSHIN210D;Transfert UDM shine;255;        ;technical;;;;End Of JobStream;
  PAXCSHIN400D;check  udm transfert;9;        ;technical;;;;Begin Of JobStream;
  PAXCSHIN400D;check  udm transfert;40;PSHIN0AA;PSHIN-400D-040T.BAT;PRAXSQL01; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-001;Check file name  move;
  PAXCSHIN400D;check  udm transfert;45;PSHIN0AB;PSHIN-400D-045T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-002;prepartion pour envoiUDM;
  PAXCSHIN400D;check  udm transfert;50;PSHIN0AC;PSHIN-400D-050T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;Udm transfert to shine;
  PAXCSHIN400D;check  udm transfert;55;PSHIN0AD;PSHIN-400D-055T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-002;Envoi de mail fin trnsfr;
  PAXCSHIN400D;check  udm transfert;255;        ;technical;;;;End Of JobStream;
  PAXCSHIN500Q;Trsfrt Ref files;9;        ;technical;;;;Begin Of JobStream;00h30
  PAXCSHIN500Q;Trsfrt Ref files;60;PSHIN0AP;PSHIN-500Q-060T.KSH;CARAA009; SVC_SE_PROD_SHIN02;F+SHIN-006;wkf w_REF_EXTRACT;00h30
  PAXCSHIN500Q;Trsfrt Ref files;70;PSHIN0AQ;PSHIN-500Q-070T.KSH;CARAA009; SVC_SE_PROD_SHIN02;F+SHIN-006;zip w_REF_EXTRACT;00h30
  PAXCSHIN500Q;Trsfrt Ref files;80;PSHIN0AR;PSHIN-500Q-080T.KSH;CARAA009; SVC_SE_PROD_SHIN02;F+SHIN-006;UDM SHIN123 REF_EXTRACT;00h30
  PAXCSHIN500Q;Trsfrt Ref files;90;PSHIN0AS;PSHIN-500Q-090T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;Transfrt udm praxcapp02;00h30
  PAXCSHIN500Q;Trsfrt Ref files;100;PSHIN0AT;PSHIN-500Q-100T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+SHIN-002;UDM SHIN124 REF_EXTRACT;00h30
  PAXCSHIN500Q;Trsfrt Ref files;110;PSHIN0AU;PSHIN-500Q-110T.KSH;PRATFUDMGTW01; svcudmu;F+SHIN-003;Tsfert UDM SHIN124;00h30
  PAXCSHIN500Q;Trsfrt Ref files;255;        ;technical;;;;End Of JobStream;00h30
  PAXCTSAD007Q;Bck PRGIEAXCDC02;9;        ;technical;;;;TSAD-007Q START;21h40
  PAXCTSAD007Q;Bck PRGIEAXCDC02;40;PTSAD0QD;PTSAD-007Q-005S.KSH;SECLPRSSPSRVC02; lin-sb-axausr;F+TSAD-075;Bck PRGIEAXCDC02;21h40
  PAXCTSAD007Q;Bck PRGIEAXCDC02;255;        ;technical;;;;TSAD-007Q FINISH;21h40
  PAXCTSWA007Q;Bck PRGIEAXCDC02;9;        ;technical;;;;TSWA-007Q START;21h40
  PAXCTSWA007Q;Bck PRGIEAXCDC02;40;PTSWA0RJ;PTSWA-007Q-005S.KSH;PRATSTSMMID01; SVC_SCHEDULING@alise.intraxa;F+TSWA-203;Bck PRGIEAXCDC02;21h40
  PAXCTSWA007Q;Bck PRGIEAXCDC02;255;        ;technical;;;;TSWA-007Q FINISH;21h40
  PAXCWEBXTRGAAA;WAIT TRGFIC-WEBX001;9;        ;\prod\AGPC\WEBX.001\flg\trt.go;;;;START;
  PAXCWEBXTRGAAA;WAIT TRGFIC-WEBX001;10;PWEBXAAC;technical;;;;ADDJOBSTREAM;
  PAXCWEBXTRGAAA;WAIT TRGFIC-WEBX001;255;        ;technical;;;;END;
  PAXCWEBXTRGAAB;Run Participations ACTOR;9;        ;\prod\AGPC\WEBX.002\in\PRTCP.csv;;;;START;
  PAXCWEBXTRGAAB;Run Participations ACTOR;10;PWEBXAAD;technical;;;;ADDJOBSTREAM;
  PAXCWEBXTRGAAB;Run Participations ACTOR;255;        ;technical;;;;END;
  PAXCWEBXTRGAAC;WAIT TRGFIC-WEBXWX2;9;        ;\prod\AGPC\COPERNIC_LIL\WEBXL_COP\in\EC_AXACES.csv;;;;START;
  PAXCWEBXTRGAAC;WAIT TRGFIC-WEBXWX2;10;PWEBXAAE;technical;;;;ADDJOBSTREAM;
  PAXCWEBXTRGAAC;WAIT TRGFIC-WEBXWX2;255;        ;technical;;;;END;
  PAXCWEBXTRGAAE;WAIT TRGFIC-WEBX224;9;        ;\prod\WEBX\data\in\PWEBXWX1\LIL_AH_I100_WX101_00*;;;;START;
  PAXCWEBXTRGAAE;WAIT TRGFIC-WEBX224;10;PWEBXAAH;technical;;;;ADDJOBSTREAM;
  PAXCWEBXTRGAAE;WAIT TRGFIC-WEBX224;255;        ;technical;;;;END;
  PAXCWEBX010Q;Chek session bloquante;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX010Q;Chek session bloquante;40;PWEBX0KN;PWEBX-010Q-000T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Run script SQL;
  PAXCWEBX010Q;Chek session bloquante;255;        ;technical;;;;End Of JobStream;
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;9;        ;technical;;;;Begin Of JobStream;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;40;PWEBX0AU;PWEBX-100Q-000T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Arr�t Application;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;42;PWEBX0DX;PWEBX-100Q-002T.KSH;PRAXCWBXLBDD01; svc_bddo_user@axa-cessions.intraxa;F+WEBX-027;Arret base Oracle Webxl;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;44;PWEBX0DY;PWEBX-100Q-004T.KSH;PRAXCWBXLBDD01; svc_bddo_user@axa-cessions.intraxa;F+WEBX-027;D{marrage Base Webxl;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;50;PWEBX0AW;PWEBX-100Q-010T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;R{cup. date comptable;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;55;PWEBX0AX;PWEBX-100Q-015T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;PMD - Module 1;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;60;PWEBX0AY;PWEBX-100Q-020T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;PMD - Module 2;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;65;PWEBX0AZ;PWEBX-100Q-025T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;PMD - Module 3;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;67;PWEBX0DQ;PWEBX-100Q-027T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Script SQL Maj EXTERNA..;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;70;PWEBX0A0;PWEBX-100Q-030T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Mis en histo fic DCPT;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;75;PWEBX0BC;PWEBX-100Q-035T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;D{marrage Application;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;80;PWEBX0BU;PWEBX-100Q-040T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Export (DataPump) AGPC;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;85;PWEBX0BV;PWEBX-100Q-045T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Export (DataPump) SGR;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;90;PWEBX0B3;PWEBX-100Q-050T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;Transfert Fichiers DUMP;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;100;PWEBX0D4;PWEBX-100Q-060M.KSH;PRAXCBDD; bddouser;F+WEBX-022;Arret base ReportXL;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;105;PWEBX0D5;PWEBX-100Q-065M.KSH;PRAXCBDD; bddouser;F+WEBX-022;D{marrage base Reportxl;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;110;PWEBX0B8;PWEBX-100Q-070T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Import (DataPump) WEBXL;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;115;PWEBX0B9;PWEBX-100Q-075T.KSH;PRAXCBDD; bddouser;F+WEBX-022;Rename Fichier DUMP AGPC;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;120;PWEBX0DN;PWEBX-100Q-080T.KSH;PRAXCBDD; bddouser;F+WEBX-022;Purge Fichier DUMP AGPC;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;125;PWEBX0DP;PWEBX-100Q-085T.BAT;PRAXCINFTCA01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-015;wf_ACORD;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;130;PWEBX0CC;PWEBX-100Q-090T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Import (DataPump) SGR;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;135;PWEBX0DM;PWEBX-100Q-095T.KSH;PRAXCBDD; bddouser;F+WEBX-022;Rename Fichier DUMP SGR;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;140;PWEBX0DO;PWEBX-100Q-100T.KSH;PRAXCBDD; bddouser;F+WEBX-022;Purge Fichier DUMP SGR;21h00
  PAXCWEBX100Q;WEBXL / ACORD / REPORTXL;255;        ;technical;;;;End Of JobStream;21h00
  PAXCWEBX103H;exe requetess controle;9;        ;technical;;;;Begin Of JobStream;08h15
  PAXCWEBX103H;exe requetess controle;40;PWEBX0JR;PWEBX-103H-040M.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;lancement requetes;08h15
  PAXCWEBX103H;exe requetess controle;50;PWEBX0JS;PWEBX-103H-050M.BAT;PRAXCAPP02-GIE; AXA-GIE\axc-reporting;F+WEBX-019;transfert des csv;08h15
  PAXCWEBX103H;exe requetess controle;255;        ;technical;;;;End Of JobStream;08h15
  PAXCWEBX107Q;FLux ACORD;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX107Q;FLux ACORD;40;PWEBX0FD;PWEBX-107Q-040T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Generate Flux ACORD;
  PAXCWEBX107Q;FLux ACORD;45;PWEBX0FE;PWEBX-107Q-045T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Arch File Lst Flux;
  PAXCWEBX107Q;FLux ACORD;50;PWEBX0KZ;PWEBX-107Q-050T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Move file Lst Flux;
  PAXCWEBX107Q;FLux ACORD;55;PWEBX0K0;PWEBX-107Q-055T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Flag Flux ACORD en cours;
  PAXCWEBX107Q;FLux ACORD;60;PWEBX0K1;PWEBX-107Q-060T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Arch file lst flux 2312;
  PAXCWEBX107Q;FLux ACORD;65;PWEBX0K2;PWEBX-107Q-065T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Move files to folder UDM;
  PAXCWEBX107Q;FLux ACORD;70;PWEBX0K4;PWEBX-107Q-070T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;UDM xWEBX107;
  PAXCWEBX107Q;FLux ACORD;75;PWEBX0K3;PWEBX-107Q-075T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;Move file UDM to INFTCA;
  PAXCWEBX107Q;FLux ACORD;80;PWEBX0FF;PWEBX-107Q-080T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;run ACOR.prepare.ksh;
  PAXCWEBX107Q;FLux ACORD;85;PWEBX0FG;PWEBX-107Q-085T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;run ACOR.send.ksh;
  PAXCWEBX107Q;FLux ACORD;90;PWEBX0K5;PWEBX-107Q-090T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;Move file INFTCA to UDM;
  PAXCWEBX107Q;FLux ACORD;95;PWEBX0K6;PWEBX-107Q-095T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;Transfert UDM xWEBX108;
  PAXCWEBX107Q;FLux ACORD;100;PWEBX0K7;PWEBX-107Q-100T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Move file from UDM;
  PAXCWEBX107Q;FLux ACORD;105;PWEBX0K8;PWEBX-107Q-105T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Arch file lst flux 2313;
  PAXCWEBX107Q;FLux ACORD;110;PWEBX0FH;PWEBX-107Q-110T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Maj FLux WEBXL ACORD;
  PAXCWEBX107Q;FLux ACORD;115;PWEBX0K9;PWEBX-107Q-115T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Delete file flux 2313;
  PAXCWEBX107Q;FLux ACORD;255;        ;technical;;;;End Of JobStream;
  PAXCWEBX108H;Rapport RUSCHLIKON;9;        ;technical;;;;Begin Of JobStream;21h30
  PAXCWEBX108H;Rapport RUSCHLIKON;40;PWEBX0H6;PWEBX-108H-040T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;w_PHASE3_RUSCHLIKON_LITE;21h30
  PAXCWEBX108H;Rapport RUSCHLIKON;255;        ;technical;;;;End Of JobStream;21h30
  PAXCWEBX110H;RBT-PRACEWEBXLBDD01;9;        ;technical;;;;WEBX-110H START;
  PAXCWEBX110H;RBT-PRACEWEBXLBDD01;40;PWEBX0AB;PWEBX-110H-005M.BAT;PRACEWEBXLBDD01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-002;RBT-PRACEWEBXLBDD01;
  PAXCWEBX110H;RBT-PRACEWEBXLBDD01;255;        ;technical;;;;WEBX-110H FINISH;
  PAXCWEBX120D;Init. decomptes attendus;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX120D;Init. decomptes attendus;40;PWEBX0C0;PWEBX-120D-000T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-024;Lancement traitement;
  PAXCWEBX120D;Init. decomptes attendus;255;        ;technical;;;;End Of JobStream;
  PAXCWEBX140Q;Dump Schema AGPC (Q);9;        ;technical;;;;Begin Of JobStream;20h00
  PAXCWEBX140Q;Dump Schema AGPC (Q);50;PWEBX0IT;PWEBX-140Q-050D.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Export Schema AGPC;20h00
  PAXCWEBX140Q;Dump Schema AGPC (Q);60;PWEBX0IU;PWEBX-140Q-060T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;TRTF UDM vers PRAXCAPP02;20h00
  PAXCWEBX140Q;Dump Schema AGPC (Q);70;PWEBX0IV;PWEBX-140Q-070T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Copie Dump;20h00
  PAXCWEBX140Q;Dump Schema AGPC (Q);255;        ;technical;;;;End Of JobStream;20h00
  PAXCWEBX150Q;Trt SQL+CSV+Mail WBX AGP;9;        ;technical;;;;Begin Of JobStream;12h00
  PAXCWEBX150Q;Trt SQL+CSV+Mail WBX AGP;50;PWEBX0IX;PWEBX-150Q-050D.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-008;Begin Of JobStream;12h00
  PAXCWEBX150Q;Trt SQL+CSV+Mail WBX AGP;255;        ;technical;;;;End Of JobStream;12h00
  PAXCWEBX200Q;D�caissement (EXP 477);9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX200Q;D�caissement (EXP 477);40;PWEBX0AT;PWEBX-200Q-040T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Export WEBXL (477);
  PAXCWEBX200Q;D�caissement (EXP 477);45;PWEBX0L7;PWEBX-200Q-045T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Move log files;
  PAXCWEBX200Q;D�caissement (EXP 477);50;PWEBX0L8;PWEBX-200Q-050T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Copy file to UDM + Arch;
  PAXCWEBX200Q;D�caissement (EXP 477);55;PWEBX0L9;PWEBX-200Q-055T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;Transfert UDM (xWEBX200);
  PAXCWEBX200Q;D�caissement (EXP 477);60;PWEBX0MA;PWEBX-200Q-060T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;Move file to INFTCA;
  PAXCWEBX200Q;D�caissement (EXP 477);65;PWEBX0MB;PWEBX-200Q-065T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;w_AlimWebXLAMB;
  PAXCWEBX200Q;D�caissement (EXP 477);70;PWEBX0MC;PWEBX-200Q-070T.KSH;CARAA009; svc_se_prod_webx01;F+WEBX-005;Move file to UDM;
  PAXCWEBX200Q;D�caissement (EXP 477);75;PWEBX0MD;PWEBX-200Q-075T.KSH;PRATFUDMGTW01; svcudmu;F+WEBX-021;Transfert UDM (xWEBX201);
  PAXCWEBX200Q;D�caissement (EXP 477);80;PWEBX0ME;PWEBX-200Q-080T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-016;Cp files to user + Arch;
  PAXCWEBX200Q;D�caissement (EXP 477);255;        ;technical;;;;End Of JobStream;
  PAXCWEBX259Q;WBXL - Imp Taux Cessions;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX259Q;WBXL - Imp Taux Cessions;40;PWEBX0LA;PWEBX-259Q-040T.BAT;PRAXCAPP02-GIE; AXA-GIE\axc-reporting;F+WEBX-019;Get file from Matfic;
  PAXCWEBX259Q;WBXL - Imp Taux Cessions;45;PWEBX0LB;PWEBX-259Q-045T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;WEBXL - Imp  (259);
  PAXCWEBX259Q;WBXL - Imp Taux Cessions;50;PWEBX0LC;PWEBX-259Q-050T.BAT;PRAXCAPP02-GIE; AXA-GIE\axc-reporting;F+WEBX-019;Push file to Matfic;
  PAXCWEBX259Q;WBXL - Imp Taux Cessions;255;        ;technical;;;;End Of JobStream;
  PAXCWEBX300M;Reboot server Webxl;9;        ;technical;;;;Begin Of JobStream;04h05
  PAXCWEBX300M;Reboot server Webxl;50;PWEBX0A1;PWEBX-300M-010M.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Arret service TOMCAT;04h05
  PAXCWEBX300M;Reboot server Webxl;80;PWEBX0A4;PWEBX-300M-020M.KSH;PRAXCWBXLBDD01; svc_bddo_user@axa-cessions.intraxa;F+WEBX-027;Arret base WEBXL;04h05
  PAXCWEBX300M;Reboot server Webxl;90;PWEBX0A5;PWEBX-300M-030M.KSH;PRAXCWBXLBDD01; svc_bddo_user@axa-cessions.intraxa;F+WEBX-027;Reboot Srv WEBXL BDD;04h05
  PAXCWEBX300M;Reboot server Webxl;100;PWEBX0A6;PWEBX-300M-040M.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-001;Reboot serveur Appli;04h05
  PAXCWEBX300M;Reboot server Webxl;255;        ;technical;;;;End Of JobStream;04h05
  PAXCWEBX308M;REBOOT WEBXL V3;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX308M;REBOOT WEBXL V3;40;PWEBX0DZ;PWEBX-308M-005M.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-024;Begin Of JobStream;
  PAXCWEBX308M;REBOOT WEBXL V3;255;        ;technical;;;;End Of JobStream;
  PAXCWEBX400X;Participations ACTOR V2;9;        ;technical;;;;Begin Of JobStream;
  PAXCWEBX400X;Participations ACTOR V2;40;PWEBX0CH;PWEBX-400X-000T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-016;Copy Fic. -&gt; Webxl;
  PAXCWEBX400X;Participations ACTOR V2;50;PWEBX0CL;PWEBX-400X-010T.BAT;PRAXCWBXLAPP01; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-017;Trt WEBXL (Import 213);
  PAXCWEBX400X;Participations ACTOR V2;60;PWEBX0CM;PWEBX-400X-020T.BAT;PRAXCAPP02; AXA-CESSIONS\SVC_SCHEDULING;F+WEBX-016;Copy Fichiers -&gt; User;
  </code></pre>
  <p>Here is the code I am trying to use :</p>
  <pre><code>function updateArchiWithImportData{
          [cmdletbinding()]
          param(
              [Parameter(ValueFromPipeline = $true)]
              [string[]]
              $ElementCsv,
      
              [Parameter()]
              [string[]]
              $Terms = @('WEBX', 'DWHS', 'COGN', 'CLOT', 'CLAI','BTRE','BISI','BDDO','ARXL', 'AGSO', 'AGPC','ACTO','FNET')
          )
          begin {
              # create the regex patterns from terms
              $patterns = $Terms | ForEach-Object {'(^' +  $_ + '\S+?)-' }
          }
      
          process{
                          # Import the  contents of the Extract_AGRe_TWS_ALL_20200925-01.csv and Create ElementCsv object
  $ElementCsv=Import-csv  $env:USERPROFILE\Desktop\Archi\Extract_AGRe_TWS_ALL_20200925.csv -Delimiter ';'
  #Loop through all the record in the CSV file
  $NewModifiedElement= ForEach($Entry in $ElementCsv){
          
          if ($Entry.&quot;Script or expected file(s)&quot; -ilike 'technical') {
                  $Entry.Jobstream=$Entry.Jobstream.trimStart('PAXCLD')
          }else {
                  # Get the name of jobSet without extension .ksh ou .bat
                  $Entry.Jobstream=$Entry.&quot;Script or expected file(s)&quot;
                 # Write-Host $Entry.Jobstream
                 # Write-Host $Entry.Jobstream.length
                  $pos_last_point = $Entry.Jobstream.LastIndexOf(&quot;.&quot;)
                  #Write-Host $pos_last_point
                  $Entry.Jobstream = $Entry.Jobstream.Substring(0,$pos_last_point).trimStart('P')  
                  $matchObj = $Entry.Jobstream | Select-String -Pattern $patterns
                  $Entry.Jobstream -replace $matchObj.Pattern, '$1'
                  #$Entry.Jobstream=$Entry.Jobstream.Remove($Entry.Jobstream.IndexOf(&quot;-&quot;),1)   
          }
          
          $Entry
  }
  $NewModifiedElement | Export-Csv &quot;$env:USERPROFILE\Desktop\Archi\Extract_AGRe_TWS_ALL_20200925-mesurecommand.csv&quot; -NoTypeInformation -Encoding UTF8
  
  }
  updateArchiWithImportData  # Call the function
  </code></pre>