Adding separators and filtering headers

(imported topic written by jpeppers91)

I have a block of text in a text file where I want to remove the top line and add semi-colon separators to it or filter it in the console where it doesn’t display the top line and add the separators.

Any ideas?

Description HotFixID InstalledOn Remove

Update ; 982861; 11/30/2012

Update ;KB958830 ;10/26/2011

Update ;KB971033 ;10/26/2011

(imported comment written by jpeppers91)

Bump

(imported comment written by jpeppers91)

Anyone?

(imported comment written by SteveHull)

If the format is consistent on each line and the items are separated by a space, you can use:

q: (concatenation ";" of substrings separated by " " of it) of lines whose (line number of it > 1) of file "C:\temp\file.txt"
A: Update;982861;11/30/2012
A: Update;KB958830;10/26/2011
A: Update;KB971033;10/26/2011

On the server side, you can filter by getting property results that don’t contain “HotFixID”

Regards, Steve

(imported comment written by jpeppers91)

My output comes out like this

I was basically trying to find a way to clean up the data where I can present it better by using delimiters, instead of 1 it fills it in between each category

Update;;;;;;;;;;;KB958830;;;10/26/2011;;;

Update;;;;;;;;;;;KB971033;;;10/26/2011;;;

Security;Update;;KB2425227;;10/26/2011;;;

Security;Update;;KB2479943;;10/26/2011;;;

Update;;;;;;;;;;;KB2484033;;10/26/2011;;;

Update;;;;;;;;;;;KB2488113;;10/26/2011;;;

Security;Update;;KB2491683;;10/26/2011;;;

Update;;;;;;;;;;;KB2492386;;10/26/2011;;;

Security;Update;;KB2503665;;10/26/2011;;;

(imported comment written by SteveHull)

Try this:

q: ((if length of parenthesized part 2 of it > 1 then parenthesized part 1 of it & parenthesized part 2 of it else parenthesized part 1 of it) & "|" & parenthesized part 3 of it & "|" & parenthesized part 4 of it) of (first matches (regex "(\w+)(\s\w+)?\s\s*(\w+)\s\s*(\d*\/\d*\/\d*)") of (it as string)) of lines whose (line number of it > 1) of file "C:\temp\file.txt"
A: Update|KB958830|10/26/2011
A: Update|KB971033|10/26/2011
A: Security Update|KB2425227|10/26/2011

(imported comment written by NoahSalzman)

And if you don’t want to use regex:

Collpase or remove white space in a text string without using regex