Im pulling a csv file from a putty session output. Im trying to get it properly formatted into columns but since the output doesnt have any commas or tabs and each row has different number of spaces my text to column ps1 doesnt format it correctly unless I do some manual editing of the file which this has to be an automated process due to the amount of files so Im trying to figure out how to get my powershell script to do it correctly. Below is the data I have in .csv, running an import-csv will return this and you can see the space situation Im talking about
Name Size Thin Provisioning Data Reduction Total Reduction Volume Snapshots Shared Space System Total
----------------------------------------------------------------------------------------------------------------------------------
Development_b_001 8T 57% 5.9 to 1 13.7 to 1 548.64G 45.20G - - 593.84G
Production_b_001 8T 36% 3.2 to 1 5.0 to 1 1.57T 0.00 - - 1.57T
Yeah I found ConvertFrom-String while I was googling just struggling to make the -templatefile now but If I can figure this out I think I got it I just dont know the proper syntax to get it just yet. Tried below but its not working how I thought it would.
instead of your string like this .....
Yours:
{Name*:*} {Size*:*} {Thin Provisioning*:*}
Try this instead based upon the data:
Name Size Thin Provisioning Data Reduction Total Reduction Volume Snapshots Shared Space System Total
----------------------------------------------------------------------------------------------------------------------------------
{name*:Development_b_001} {Size:8T} {Thin_provisioning:57%}
{name*:Production_b_001} {Size:8T} {Thin_provisioning:36%}
Make sure you have enough samples to provide to the Convertfrom-string engine in your template file. I would use at least 3 lines, and if they each have slightly different sizes/values that is better.