title: Select Specific data from text file and export it into csv
body: <p>I am stuck at a conversion of text file into csv where selected data needs to be put inside that csv. So far I have managed only one line of code that works for me and I am unable to take it further. </p>
  
  <p><strong>Text file:</strong></p>
  
  <p>Search: Object: EMP NAMES under /USER/ENT/FOL1</p>
  
  <p>Object: EMP NAMES   Object Location Point Alias EMP name<br>
  1SIG_MOU_RM_CTL /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_COMBINED_ADJ   /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_CONTROL    /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_BKR    /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_MAN_ADJ    /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_PSS    /USER/ENT/BASE/FOL1<br>
  1SIG_MOU_REG_MODE   /USER/ENT/BASE/FOL1<br>
  SIG_MOUD_TUNE   /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_41CONT  /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_AUT_MD  /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_BASE_MODE   /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_FC1CTRL /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_FC2CTRL /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_PSS_MODE    /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_SS_SIG_FIFO /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_SS_FCR_FIFO /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MOU_SP_TYPE /USER/ENT/BASE/FOL1     BOARD<br>
  SIG_MAST_BA_CONT    /USER/ENT/BASE/FOL1     MVAR<br>
  SIG_ST_BE_ALG   /USER/ENT/BASE/FOL1     VALPROF </p>
  
  <p>SIG_SP_SIG_VALPROF  /USER/ENT/BASE/FOL1     VALPROF </p>
  
  <p>SIG_SP_FCR_VALPROF  /USER/ENT/BASE/FOL1     VALPROF </p>
  
  <p>SIG_TRANSFER_MOD_DC_SP  /USER/ENT/BASE/FOL1     RELOC<br>
  LVR_MOU_MODULE_CMDS /USER/ENT/BASE/FOL1     BOARD<br>
  FCN0001 /USER/ENT/BASE/FOL1/Work Area 5/0001    FCN0001_900 SWEEP<br>
  FCN0001001  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN0001005  /USER/ENT/BASE/FOL1/Work Area 5/0001        BOARD<br>
  FCN0001008  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN000100A  /USER/ENT/BASE/FOL1/Work Area 5/0001        BOARD<br>
  FCN000100C  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN000100E  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN0001010  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN0001012  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN0001018  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN000101C  /USER/ENT/BASE/FOL1/Work Area 5/0001        BIFOLD<br>
  FCN0001020  /USER/ENT/BASE/FOL1/Work Area 5/0001        CHANGEOVER<br>
  FCN0001028  /USER/ENT/BASE/FOL1/Work Area 5/0001        HOLD<br>
  FCN0001029  /USER/ENT/BASE/FOL1/Work Area 5/0001        HOLD<br>
  FCN000102A  /USER/ENT/BASE/FOL1/Work Area 5/0001        HOLD<br>
  FCN0002 /USER/ENT/BASE/FOL1/Work Area 5/0002    FCN0002_901 SWEEP<br>
  FCN0002001  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN000200B  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN000200D  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN0002013  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN0002017  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN0002019  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN000201B  /USER/ENT/BASE/FOL1/Work Area 5/0002        CLONE<br>
  FCN0003 /USER/ENT/BASE/FOL1/Work Area 3/0003    FCN0003_301 SWEEP<br>
  FCN0003010  /USER/ENT/BASE/FOL1/Work Area 3/0003        BIFOLD<br>
  FCN0003016  /USER/ENT/BASE/FOL1/Work Area 3/0003        SINGLE<br>
  FCN0004 /USER/ENT/BASE/FOL1/Work Area 2/0004    FCN0004_064 SWEEP<br>
  FCN0004005  /USER/ENT/BASE/FOL1/Work Area 2/0004        QUALITY 
  FCN0004006  /USER/ENT/BASE/FOL1/Work Area 2/0004        QUALITY 
  FCN0005 /USER/ENT/BASE/FOL1/Work Area 3/0005    FCN0005_201 SWEEP<br>
  FCN0005007  /USER/ENT/BASE/FOL1/Work Area 3/0005        SINGLE<br>
  FCN0005008  /USER/ENT/BASE/FOL1/Work Area 3/0005        SINGLE<br>
  FCN000500A  /USER/ENT/BASE/FOL1/Work Area 3/0005        SINGLE<br>
  FCN0005010  /USER/ENT/BASE/FOL1/Work Area 3/0005        SINGLE<br>
  FCN0005023  /USER/ENT/BASE/FOL1/Work Area 3/0005        SINGLE<br>
  FCN0006 /USER/ENT/BASE/FOL1/Work Area 3/0006    FCN0006_204 SWEEP<br>
  FCN0006002  /USER/ENT/BASE/FOL1/Work Area 3/0006        BIFOLD<br>
  FCN0006007  /USER/ENT/BASE/FOL1/Work Area 3/0006        HOLD<br>
  FCN0006012  /USER/ENT/BASE/FOL1/Work Area 3/0006        BIFOLD<br>
  FCN0006014  /USER/ENT/BASE/FOL1/Work Area 3/0006        LOW 
  FCN0007 /USER/ENT/BASE/FOL1/Work Area 5/0007    FCN0007_160 SWEEP<br>
  FCN0008 /USER/ENT/BASE/FOL1/Work Area 5/0008    FCN0008_161 SWEEP<br>
  FCN0009 /USER/ENT/BASE/FOL1/Work Area 3/0009    FCN0009_303 SWEEP<br>
  FCN0009001  /USER/ENT/BASE/FOL1/Work Area 3/0009        SEQ 
  FCN0009016  /USER/ENT/BASE/FOL1/Work Area 3/0009        LOW 
  FCN0009017  /USER/ENT/BASE/FOL1/Work Area 3/0009        SUM 
  FCN000901C  /USER/ENT/BASE/FOL1/Work Area 3/0009        CLONE<br>
  FCN000901D  /USER/ENT/BASE/FOL1/Work Area 3/0009        OFI 
  FCN000901F  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN0009026  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN0009029  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN000902E  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGHMON 
  FCN0009036  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGHMON 
  FCN0009038  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN0009039  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGHMON 
  FCN000903A  /USER/ENT/BASE/FOL1/Work Area 3/0009        SUM 
  FCN000903B  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGHMON 
  FCN000903C  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN000903D  /USER/ENT/BASE/FOL1/Work Area 3/0009        SUM 
  FCN000903E  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGHMON 
  FCN0009043  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN000904C  /USER/ENT/BASE/FOL1/Work Area 3/0009        HOLD<br>
  FCN000904D  /USER/ENT/BASE/FOL1/Work Area 3/0009        HOLD<br>
  FCN000904E  /USER/ENT/BASE/FOL1/Work Area 3/0009        HOLD<br>
  FCN000904F  /USER/ENT/BASE/FOL1/Work Area 3/0009        HIGH<br>
  FCN0009050  /USER/ENT/BASE/FOL1/Work Area 3/0009        GAIN<br>
  FCN0009051  /USER/ENT/BASE/FOL1/Work Area 3/0009        SINGLE<br>
  FCN000A /USER/ENT/BASE/FOL1/Work Area 5/000A    FCN000A_150 SWEEP<br>
  FCN000A001  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A003  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A005  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A006  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A008  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A00A  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A00D  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A00E  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A010  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A012  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A014  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A017  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A019  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A01C  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A01E  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A020  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A022  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A025  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD<br>
  FCN000A027  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A02C  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A02D  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A02F  /USER/ENT/BASE/FOL1/Work Area 5/000A        CLONE<br>
  FCN000A03A  /USER/ENT/BASE/FOL1/Work Area 5/000A        BIFOLD  </p>
  
  <p>So far I am able to read the specific data using:</p>
  
  <pre><code>$a = (Get-Content *.txt) | Select-String "ValProf" , "BIFOLD" , "BOARD" | FOREACH {$_ -replace '/User/ENT/Base/'
  
          [array]$obj += New-Object psobject -Property @{
  
                   EMP = "Value in first column"
                  Name  = "value in second column"
  
  
  }
  }
  $a | Select-Object EMP , Name  | Export-Csv Output.csv -NoTypeInformation
  </code></pre>
  
  <p>The intended output will be in a csv format with 2 column headings EMP and Name. EMP shall contain SIG_MOUD_TUNE and Name shall contain BOARD. The output what i am trying to get is :- <a href="https://i.stack.imgur.com/hy4m4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hy4m4.jpg" alt="The output"></a></p>