I am trying to process a text file that contains multiple entries, I am interested in the Data filed of the text which consists of Name, Id, Size and Page83 ID.Command: show PhysicalDisk name='IBM (721)'Status: SuccessTime: 2017-06-30 15:50:50,051 ESTData:  Name = IBM (721)  Id = 0004fb0000180000d27ba1c974a69157  Size (GiB) = 15.0  Shareable = No  Page83 ID = 360050768018385ace800000000000d6a  Thin Provision = Yes  VolumeGroup = Generic_SAN_Volume_Group @ Unmanaged FibreChannel Storage Array  [FibreChannel Volume Group]  San Server = Unmanaged FibreChannel Storage Array  [Unmanaged FibreChannel Storage Array]Command: show PhysicalDisk name='IBM (722)'Status: SuccessTime: 2017-06-30 15:50:53,636 ESTData:  Name = IBM (730)  Id = 0004fb0000180000627770ff185759b6  Size (GiB) = 100.0  Shareable = No  Page83 ID = 360050768018385ace800000000000d6b  Thin Provision = Yes  VolumeGroup = Generic_SAN_Volume_Group @ Unmanaged FibreChannel Storage Array  [FibreChannel Volume Group]  San Server = Unmanaged FibreChannel Storage Array  [Unmanaged FibreChannel Storage Array]I would like to process this text and put it in the excel sheet rows and columns.This is just a sample output for two data fields. Also want to know how can we have this in place for N number of data fields.
Text processing and exporting the content to an excel sheet
shell script;shell;awk;sed;regular expression
For a simple comma-separated csv to be imported into excel you could use something likesed -n '/Name = /!d  N;N;N;N  y/\n/,/  s/, *Shareable = [^,]*//  s/[^,=]*= //g;p' yourfileThe first line deletes all lines except the Name = ones. Continue only for those and append the four next lines to the buffer with N. The y command replaces the newlines between the lines with the separating commas. The first s command removes the Shareable line and the second one removes the part upto the = to leave only the value.It will work for any number of rows. Text fields will be identified automatically without quotes in this case.