Link to home
Start Free TrialLog in
Avatar of john lambert
john lambert

asked on

how to split multiple lines delimiter :

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$
Avatar of SubSun
SubSun
Flag of India image

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

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

Avatar of john lambert
john lambert

ASKER

yes but cna u add Ouput.txt please?
thank you
Try..
GC C:\Test.txt | %{($_ -split ":","2")[1]} | Out-File C:\output.txt

Open in new window

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
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India 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
thank you.......
Other option is..
GC C:\Test.txt | %{($_ -split ":",3)[2]} | Out-File C:\output.txt

Open in new window