john lambert
asked on
how to split multiple lines delimiter :
windows os
this is only a small exmaple about how to split this:
Output:
176.58.104.12:aida1380.139 3
2.184.85.16:BARAN_34902170 12b
87.107.202.187:11011011011 0er1382
79.130.174.6:evr2010$
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$
Output:
176.58.104.12:aida1380.139
2.184.85.16:BARAN_34902170
87.107.202.187:11011011011
79.130.174.6:evr2010$
You have a couple of different options (I'll use Powershell). For each line you can use a substring:
Or you could break it into an array:
$string = "aida.akbari789@gmail.com:176.58.104.12:aida1380.1393"
$output = $string.Substring($string.IndexOf(':')+1)
Write-Host $output
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]
ASKER
yes but cna u add Ouput.txt please?
thank you
thank you
Try..
GC C:\Test.txt | %{($_ -split ":","2")[1]} | Out-File C:\output.txt
ASKER
in fact my list look like this:
Output.txt
IP:pass
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
Output.txt
IP:pass
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you.......
Other option is..
GC C:\Test.txt | %{($_ -split ":",3)[2]} | Out-File C:\output.txt
Open in new window
Split from file..Open in new window