Link to home
Start Free TrialLog in
Avatar of dpk_wal
dpk_walFlag for India

asked on

text line with no range or eg

Pls refer to my earlier question:
https://www.experts-exchange.com/questions/26836792/extract-and-modify-data-from-text-file.html

I have lines which do not have range or eq as listed in question earlier.

Sample text:
permit      tcp      host_10_13_20_62      host_10_14_6_84      port_30094
permit      tcp      host_10_13_35_51      host_10_14_6_84      port_30094

permit      tcp      10_96_72_64      29      host_10_14_5_53      Netbackup1      

permit      tcp      host_10_96_72_64       10_14_5_53 30      Netbackup1      

permit      tcp      10_13_35_51      30  10_14_6_84 22       port_30094

Here again I can have combination of 10_ and host_ addresses for source and destination. All 10_ addresses have a single/two digit mask separated by space or tab.
For application I need the last column.

Expected output:
source [ host_10_13_20_62 host_10_13_35_51 ] destination host_10_14_6_84 application port_30094

source 10_96_72_64_29 destination host_10_14_5_53 application Netbackup1

source host_10_96_72_64 destination 10_14_5_53_30 application Netbackup1

source 10_13_35_51_30 destination 10_14_6_84_22 application port_30094

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dpk_wal

ASKER

Works great; thank you!