• Thanks Amit.

    Yes there are 1780 users in the data, so each would have their own privileges.

    Here is an extract of the file for 2 different users: >>>

    *the words highlighted in blue is what we are trying to extract

    Quote:

    Username: ALANCPS Owner: PENSIONS

    Account: PENSION UIC: [300,0] ([PENSIONS])

    CLI: DCL Tables: DCLTABLES

    Default: CPS_DEVICE:[CPS]

    LGICMD: LOGIN

    Flags: DisUser

    Primary days: Mon Tue Wed Thu Fri

    Secondary days: Sat Sun

    No access restrictions

    Expiration: (none) Pwdminimum: 8 Login Fails: 0

    Pwdlifetime: 30 00:00 Pwdchange: (pre-expired)

    Last Login: (none) (interactive), (none) (non-interactive)

    Maxjobs: 0 Fillm: 1024 Bytlm: 130000

    Maxacctjobs: 0 Shrfillm: 0 Pbytlm: 0

    Maxdetach: 0 BIOlm: 4096 JTquota: 8192

    Prclm: 10 DIOlm: 4096 WSdef: 100000

    Prio: 4 ASTlm: 250 WSquo: 200000

    Queprio: 0 TQElm: 20 WSextent: 210000

    CPU: (none) Enqlm: 2000 Pgflquo: 4000000

    Authorized Privileges:

    ACNT ALLSPOOL ALTPRI AUDIT BUGCHK BYPASS

    CMEXEC CMKRNL DIAGNOSE DOWNGRADE EXQUOTA GROUP

    GRPNAM GRPPRV IMPERSONATE IMPORT LOG_IO MOUNT

    NETMBX OPER PFNMAP PHY_IO PRMCEB PRMGBL

    PRMMBX PSWAPM READALL SECURITY SETPRV SHARE

    SHMEM SYSGBL SYSLCK SYSNAM SYSPRV TMPMBX

    UPGRADE VOLPRO WORLD

    Default Privileges:

    ACNT ALLSPOOL ALTPRI AUDIT BUGCHK BYPASS

    CMEXEC CMKRNL DIAGNOSE DOWNGRADE EXQUOTA GROUP

    GRPNAM GRPPRV IMPERSONATE IMPORT LOG_IO MOUNT

    NETMBX OPER PFNMAP PHY_IO PRMCEB PRMGBL

    PRMMBX PSWAPM READALL SECURITY SETPRV SHARE

    SHMEM SYSGBL SYSLCK SYSNAM SYSPRV TMPMBX

    UPGRADE VOLPRO WORLD

    AND

    Quote:

    Username: AFFLNETC07 Owner: PENSIONS

    Account: PENSION UIC: [300,0] ([PENSIONS])

    CLI: DCL Tables: DCLTABLES

    Default: CPS_DEVICE:[CPS]

    LGICMD: LOGIN

    Flags: DisCtlY Restricted DisUser

    Primary days: Mon Tue Wed Thu Fri

    Secondary days: Sat Sun

    Primary 000000000011111111112222 Secondary 000000000011111111112222

    Day Hours 012345678901234567890123 Day Hours 012345678901234567890123

    Network: ----- No access ------ ----- No access ------

    Batch: ##### Full access ###### ##### Full access ######

    Local: ##### Full access ###### ##### Full access ######

    Dialup: ----- No access ------ ----- No access ------

    Remote: ##### Full access ###### ##### Full access ######

    Expiration: (none) Pwdminimum: 8 Login Fails: 0

    Pwdlifetime: 30 00:00 Pwdchange: (pre-expired)

    Last Login: (none) (interactive), (none) (non-interactive)

    Maxjobs: 0 Fillm: 1024 Bytlm: 64000

    Maxacctjobs: 0 Shrfillm: 0 Pbytlm: 0

    Maxdetach: 0 BIOlm: 150 JTquota: 4096

    Prclm: 2 DIOlm: 150 WSdef: 2000

    Prio: 4 ASTlm: 250 WSquo: 2048

    Queprio: 0 TQElm: 20 WSextent: 16384

    CPU: (none) Enqlm: 2000 Pgflquo: 900000

    Authorized Privileges:

    NETMBX TMPMBX

    Default Privileges:

    NETMBX TMPMBX

    As you can see not all users have the same number of privileges.

    So basically this is my thought process: >>>

    There are 1780 users in the text file.

    For Authorised Privileges:

    -> Read every line until textline = "Authorised Privileges"

    -> Write every line after this to a single string file with a "," delimiter

    -> Stop writing until textline = "Default Privileges"

    Expected output:

    String 1: ACNT,ALLSPOOL,ALTPRI,AUDIT,BUGCHK,BYPASS,CMEXEC,CMKRNL,DIAGNOSE,DOWNGRADE,EXQUOTA,GROUP,GRPNAM,GRPPRV,IMPERSONATE,IMPORT,LOG_IO,MOUNT,NETMBX,OPER,PFNMAP...etc...,WORLD

    String 2:

    NETMBX,TMPMBX