nileshjsr has asked for the wisdom of the Perl Monks concerning the following question:
Hi I am new to perl and trying to write script on windows 10.
I am trying to extract valid email address from 7th column and rest column has to print as it is
I have to ignore those email which is coming after word send
Sample file
150003430000,MOHAMED AHMED DIDI,265943,54,265943,OC00902,|e.mail: brid +gepoint@dhivehinet.net.mv|send details to fototek@dhivehinet.net.mv|e +mail username: bridgepoint /password: <redacted> 150000450000,ADAM NASEER,261075,54,261075,OA00426,|"CUSTOMER WILL COM +E AND COLLECT THE PASSWORD FROM CFO|PREFFERED USER NAME: adam@dhivehi +net.net.mv|adam@dhivehinet.net.mv is not available|customer requested + rishfa@dhivehinet.net.mv|email username: rishfa /password: <redacted +> 980025660000,K.D.M. NO. 01,292497,54,292497,PB00340,|POP3 EMAIL TO BE +TRANSFERRED TO IN0687|USER ID:hava|PASSWORD:<redacted> 120003690000,AHMED IBRAHIM DIDI,178845,54,178845,LB00698,|email:campus +@dhivehinet.net.com|password:<redacted>|Refer to SO LB00658|TRANSFER +OF DHIVEHINET ACCOUNT 960003123000,DHIRAAGU NOC,27333822,54,27333822,XK30203,|epc@dhivehinet +.net.mv. Send details to: Adam Shahmy (E-|NOC)|"email: epc@dhivehinet +.net.mv created|Details sent to: adam.shahmy@dhiraagu.com.mv 990027520000,ATOLL DISCOVERY PVT LTD,127869,54,127869,IL00070,|USER ID +: discover| atoll|passwd: <redacted>|userid: discover 140001680800,MOOKAI SUITES,399783,54,399783,RI00793,|Pop3 account:mook +aisuites@dhivehinet.net.mv|Send details:accounts@mookaisuites.com.mv| +Setup charges billed 150013180000,MOHAMED HASSAN,285182,54,285182,OJ00669,|Pop3 email:nfpl +@dhivehinet.net.mv|Pls send the details to: newfrontiers90@hotmail.co +m|email username: nfpl /password: <redacted> 140014970000,ASSISTANCE OF MINDFUL ADVANCE MALDIVES,256832,54,256832,N +K00226,|POP3-A/C:ama@dhivehinet.net.mv|PLS SEND THE DETAILS TO : blue +_k@dhivehinet.net.mv|username: ama /password: <redacted> 960003120204,DHIRAAGU MOBILE NETWORKS,22585648,54,22585648,VH43719,|PO +P 3 Email: VoiceCoreSupport@dhivehinet.net.mv|*This address will be u +sed as a destination for|VoiceCore complaints|*Send details to: ali.a +slam@dhiraagu.com.mv|Email VoiceCoreSupport@dhivehinet.net.mv created +|details sent: ali.aslam@dhiraagu.com.mv 960003120203,DHIRAAGU SWITCHING,22681370,54,22681370,VI30660,|*Email a +ddress: ireg@dhivehinet.met.mv|*Details to: ismail.samah@dhiraagu.com +.mv|Email created and details sent 900012100000,AHMED MANSOOR,27080982,54,27080982,XI25365,|*email setup + charge 200/- paid*email address (sasaim@d|hivehinet.net.mv)*pls send + the details to (mohamedshan|"ah@gmail.com)*informed activation targe +t|"al|"email: sasaim@dhivehinet.net.mv created|Details sent to: moham +edshanah@gmail.com 900011880000,FACULTY OF HEALTH SCIENCES,292573,54,292573,PB00400,|REFE +R PB00079.|DOMAIN:ihs.edu.mv|EMAIL:ihs_moh@dhivehinet.net.mv|No Actio +n Taken 100010150000,PRO DIVERS PVT. LTD.,136569,54,136569,JE00685,|user id|va +karupd|vakapd|pdvakru|password:<redacted>|email: vakarupd@dhivehinet. +net.mv|dialup: vakarupd 100027930000,OCEAN PARADISE MALDIVES PVT. LTD.,150639,54,150639,JL0061 +5,|USER ID: opm|USER ID: htaggart|REFER JL00614
Output
150003430000,MOHAMED AHMED DIDI,265943,54,265943,OC00902,bridgepoint@d +hivehinet.net.mv 150000450000,ADAM NASEER,261075,54,261075,OA00426,rishfa@dhivehinet.n +et.mv 980025660000,K.D.M. NO. 01,292497,54,292497,PB00340, 120003690000,AHMED IBRAHIM DIDI,178845,54,178845,LB00698,campus@dhiveh +inet.net.com
2019-03-30 Athanasius redacted passwords, removed paragraph tags from code, and added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extract email address from text file
by marto (Cardinal) on Mar 12, 2019 at 14:05 UTC | |
|
Re: Extract email address from text file
by thanos1983 (Parson) on Mar 12, 2019 at 14:28 UTC | |
|
Re: Extract email address from text file
by kcott (Archbishop) on Mar 13, 2019 at 08:29 UTC |