Solved

how to split multiple lines delimiter :

Posted on 2016-10-21
8
142 Views
Last Modified: 2016-10-21
windows os
this is only a small exmaple about how to split this:

aida.akbari789@gmail.com:176.58.104.12:aida1380.1393
baran_booran1@yahoo.com:2.184.85.16:BARAN_3490217012b
erfanmansorirad@yahoo.com:87.107.202.187:110110110110er1382
kdvm910@gmail.com:79.130.174.6:evr2010$

Open in new window


Output:

176.58.104.12:aida1380.1393
2.184.85.16:BARAN_3490217012b
87.107.202.187:110110110110er1382
79.130.174.6:evr2010$
0
Comment
Question by:john lambert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 41854567
Try using powerShell..
("aida.akbari789@gmail.com:176.58.104.12:aida1380.1393" -split ":","2")[1]

Open in new window

Split from file..
GC C:\Test.txt | %{($_ -split ":","2")[1]}

Open in new window

0
 
LVL 13

Expert Comment

by:Dustin Saunders
ID: 41854568
You have a couple of different options (I'll use Powershell).  For each line you can use a substring:

$string = "aida.akbari789@gmail.com:176.58.104.12:aida1380.1393"

$output = $string.Substring($string.IndexOf(':')+1)

Write-Host $output

Open in new window


Or you could break it into an array:
$string = "aida.akbari789@gmail.com:176.58.104.12:aida1380.1393"

$array = $string.Split(':')

$output = $array[1] + ":" + $array[2]

Open in new window

1
 

Author Comment

by:john lambert
ID: 41854571
yes but cna u add Ouput.txt please?
thank you
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 40

Expert Comment

by:Subsun
ID: 41854574
Try..
GC C:\Test.txt | %{($_ -split ":","2")[1]} | Out-File C:\output.txt

Open in new window

1
 

Author Comment

by:john lambert
ID: 41854579
in fact my list look like this:

gfhghjh:ghjtilouijgffghgy@gmail.com:71.200.43.81:wsxcderfv123
server-ZkOficial:yanuari_la_bella@hotmail.com:186.88.91.191:uewyK4Tk2MARkwb2
JesusEnrique:jesus_enriquest@hotmail.com:189.132.59.13:DxXp8kTUyMA1fsCZ
LUISA:luisita_crazul@hotmail.com:187.242.244.123:PUMITAS20

Open in new window


Output.txt
IP:pass
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41854587
Try following and see if it works for you..
GC C:\Test.txt | %{($_ -split ".com:","2")[1]} | Out-File C:\output.txt

Open in new window

1
 

Author Closing Comment

by:john lambert
ID: 41854593
thank you.......
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41854595
Other option is..
GC C:\Test.txt | %{($_ -split ":",3)[2]} | Out-File C:\output.txt

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question