I have a file containing a few thousand lines of text. I need to extract some data from it, but the data I need is always 57 characters from the left, and 37 characters from the end. The bit I need (in the middle) is of varying length.
e.g. 20141126_this_piece_of_text_needs_to_be_removed<b>this_needs_to_be_kept</b>this_also_needs_to_be_removed
So far I have got:
SELECT-STRING -path path_to_logfile.log -pattern "20141126.*<b>" |
FOREACH{$_.Line} |
FOREACH{
$_.substring(57)
}
This gets rid of the text at the start of the line, but I can't see how to get rid of the text from the end.
I tried:
$_.subString(0,-37)
$_.subString(-37)
but these didn't work
Is there a way to get rid of the last x characters?