Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a text file with the following information:


I need to remove all characters that appear before For my file, it looks like this:,,

I'm using the Poweshell to do this, but without success.

share|improve this question

A lot of it will depend on how consistent your data will be. There will be a multitude of methods. You could do it with a split:

$test = '24.;128.32.;128,6;0.128.68.;128,1.;0.76.;;;;;0,1.;0.4.;0,2.;0.5.;0,4.;;;0.76.;128,;;;;;;;;,,'
$partIWant = $test.Split(';')[$($test.Split(';').Count-1)]

You could use a regex as well:

$partIWant = $test -replace '.+(\d+.\d+\.\d+\.\d+\.\d+,\d+\.\d+\.\d+\.\d+,)', '$1'

You will need to pick the method that you want to use and craft it to the specific data that you will be working with.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.