Powershell - how to obtain previous lines from text file?
Try with something like this:
(( GC myfile.txt | Select-String 'DatabaseSize = 35' -Context 3 ).context.precontext)[0]
In case of multiple match:
(GC myfile.txt | SELECT-STRING 'DATABASESIZE = 35' -Context 3 ) | % { ($_.context.precontext)[0] }