0
votes

I'm trying to extract the directory between the 5th and 6th instance of ":" in each line below. I was thinking I would use a foreach loop to iterate through each line of my file and then use substring to grab the path between those characters. Anyone have a suggestion?

FTPAccount1:x:1001:10113:Ryan Murphy:/ftp/sub/Account1:/bin/bash
FTPAccount2:x:1002:10113:Ryan Murphy:/ftp/sub2/Account2:/bin/bash

('FTPAccount1:x:1001:10113:Ryan Murphy:/ftp/sub/Account1:/bin/bash' -split ':')[5] - Olaf
Awesome thanks! The split command seems to work so I'll have to incorporate that. - BuddyLee
Yeah Baby, Yeah! ;-) :-D - Olaf