Awk command to powershell

Hi i try to transcript an awk command to powershell

i have a text file

SQLBefore:=
UPDATE SYSADM.PS_S1_R_FLWUP
SET S1_FLWUP_DATE_CHK=SYSTIMESTAMP
, S1_FLWUP_DATE_LAST=NULL
WHERE S1_FLWUP_NAME='GGGGG_ETAT_JJ'

SQLAfter:=
UPDATE SYSADM.PS_S1_R_FLWUP
SET S1_FLWUP_DATE_LAST=SYSTIMESTAMP
, S1_FLWUP_STAT_SID=1
WHERE S1_FLWUP_NAME='TTTTT_ETAT_'

SQLFailed:=
UPDATE SYSADM.PS_S1_R_FLWUP
SET S1_FLWUP_DATE_LAST=S1_FLWUP_DATE_FRST
, S1_FLWUP_STAT_SID=3
WHERE S1_FLWUP_NAME='JJJJ_ETAT_JJJ'

And i would like to do the same than this unix command in powershell

cat $this_file|awk '/SQLAfter/,/SQLFailed/ {print $0}'| grep -v SQL|sed -e 's/^$//'

It's return

UPDATE SYSADM.PS_S1_R_FLWUP
SET S1_FLWUP_DATE_CHK=SYSTIMESTAMP
, S1_FLWUP_DATE_LAST=NULL
WHERE S1_FLWUP_NAME='GGGGG_ETAT_JJ'

I'm getting stuck to do the delimiter like awk, between "SQLBefore:=" and "SQLAfter:=" with powershell


Thanks for your help.

I'm a beginner of powershell sorry for my english

July 17th, 2015 9:21am

Thks for your help :)

I try to return the section with the command split

Free Windows Admin Tool Kit Click here and download it now
July 17th, 2015 11:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics