Save two list of strings to a file

Hello, I have some Data which I want to save in a file.

Here is the Parse output. :point_down:

And I want to save both of the lists like this.

image

Please reply to this post if you guys got any solutions! Thank you!:heart:

Please provide the two lists in a way that I can copy them

Here you go sir,

Names (ListOfStrings) = [[Michael Bradford, Ralph Simon, Michele Sebile, Lynne Stevenson, Delores Graf, Jack Mack, Alyssa Pelletier, Qwerty Pinijkarn, Djdn Ndjeio, Heywood Jablome], [Linda Flores, Augustine Hirst, Greo Juuu, Qwerty Bateman, Quavo Smith, Amelia Qwerty, Edward Studert, Cynthia Rodgers, Corena Rodgers], [Nan Green, Chris Studert, Arlan Nottellin, Lm Pelletier, Joe Nottellin, Erica Qwerty, Colette Plotmonter, Jimmy Green, Linell Tillman, Dieosa Garden], [Qwerty Qwerty, Qwerty Qwerty, Derek Ramsey, Qwerty Ytrewq, John Black, Qwerty Qwerty, T. W., Qwerty Qwerty, Vol Vol, Qwerty Mnbvc], [Qwerty Qwerty, Jordan Banning, Joe Moe, Qwert Yee, Hbbh Nb, Qwerty Juuu, Ladio Dsadif, Bob Vila, John Whitehouse, Nonbob Michaelshcxmit], [Max Cavidson, O. Ee, Bob Ewell, Qwerty Qwerty, Qwerty Uiop, Andrew Pelletier, Maddy Freaks, Qwerty Ytrew, Aded Sedf, Qwerty Ytrewq], [John Black, Qwerty Itis, John Black, Bob Saget, Bob Bobb, Emmett Rose, Rgret Eryrtu, Bitch Tits, Jonathan Krane, Afaasddaa Asdasda], [Jeffrey Freiden, Erica Qwerty, Rodger Rodgers, Jack W Short, Colette Plotmonter, Jimmy Green, Roxane Hill, Danny Dono, Mike Miquirt, Darryl Robinson], [Chris Studert, Dieosa Garden, Qwerty Qwerty, Corena Rodgers, Qwerty Stanley, Arlan Nottellin, Mark Plotmonter, Amelia Qwerty, Lm Pelletier, Joe Nottellin], [Antwan Henderson, Qwerty Qwerty, Roxane Hill, Bob Barker, Sret Qert, Nan Green, Jen Howard, Cornwall Hill Rd Patterson, Danny Dono, Edward Studert]]
LastUpdated (ListOfStrings) = [[Last updated 11 months ago., Last updated 11 months ago., Last updated 11 months ago., Last updated 11 months ago., Last updated 6 months ago., Last updated 6 months ago., Last updated 7 months ago., Last updated 7 months ago., Last updated 8 months ago., Last updated 1 year ago.], [Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 2 years ago., Last updated 2 years ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.], [Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.], [Last updated 3 years ago., Last updated 4 years ago., Last updated 4 years ago., Last updated 6 years ago., Last updated 6 years ago., Last updated 7 years ago., Last updated 7 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago.], [Last updated 10 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 10 years ago., Last updated 11 years ago., Last updated 10 years ago., Last updated 11 years ago., Last updated 11 years ago.], [Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago.], [Last updated 12 years ago., Last updated 13 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 14 years ago., Last updated 14 years ago.], [Last updated 13 years ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.], [Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.], [Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]]

And I want to convert and save it as a text file info.txt

Last updated 11 months ago.
[+] Name = Michael Bradford

Last updated 11 months ago.
[+] Name = Ralph Simon

Last updated 11 months ago.
[+] Name = Michele Sebile

And So On …

BLOCK:ConstantList
LABEL:Names
  value = ["[Michael Bradford, Ralph Simon, Michele Sebile, Lynne Stevenson, Delores Graf, Jack Mack, Alyssa Pelletier, Qwerty Pinijkarn, Djdn Ndjeio, Heywood Jablome]", "[Linda Flores, Augustine Hirst, Greo Juuu, Qwerty Bateman, Quavo Smith, Amelia Qwerty, Edward Studert, Cynthia Rodgers, Corena Rodgers]", "[Nan Green, Chris Studert, Arlan Nottellin, Lm Pelletier, Joe Nottellin, Erica Qwerty, Colette Plotmonter, Jimmy Green, Linell Tillman, Dieosa Garden]", "[Qwerty Qwerty, Qwerty Qwerty, Derek Ramsey, Qwerty Ytrewq, John Black, Qwerty Qwerty, T. W., Qwerty Qwerty, Vol Vol, Qwerty Mnbvc]", "[Qwerty Qwerty, Jordan Banning, Joe Moe, Qwert Yee, Hbbh Nb, Qwerty Juuu, Ladio Dsadif, Bob Vila, John Whitehouse, Nonbob Michaelshcxmit]", "[Max Cavidson, O. Ee, Bob Ewell, Qwerty Qwerty, Qwerty Uiop, Andrew Pelletier, Maddy Freaks, Qwerty Ytrew, Aded Sedf, Qwerty Ytrewq]", "[John Black, Qwerty Itis, John Black, Bob Saget, Bob Bobb, Emmett Rose, Rgret Eryrtu, Bitch Tits, Jonathan Krane, Afaasddaa Asdasda]", "[Jeffrey Freiden, Erica Qwerty, Rodger Rodgers, Jack W Short, Colette Plotmonter, Jimmy Green, Roxane Hill, Danny Dono, Mike Miquirt, Darryl Robinson]", "[Chris Studert, Dieosa Garden, Qwerty Qwerty, Corena Rodgers, Qwerty Stanley, Arlan Nottellin, Mark Plotmonter, Amelia Qwerty, Lm Pelletier, Joe Nottellin]", "[Antwan Henderson, Qwerty Qwerty, Roxane Hill, Bob Barker, Sret Qert, Nan Green, Jen Howard, Cornwall Hill Rd Patterson, Danny Dono, Edward Studert]"]
  => VAR @names
ENDBLOCK

BLOCK:ConstantList
LABEL:Updated
  value = ["[Last updated 11 months ago., Last updated 11 months ago., Last updated 11 months ago., Last updated 11 months ago., Last updated 6 months ago., Last updated 6 months ago., Last updated 7 months ago., Last updated 7 months ago., Last updated 8 months ago., Last updated 1 year ago.]", "[Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 2 years ago., Last updated 2 years ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]", "[Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]", "[Last updated 3 years ago., Last updated 4 years ago., Last updated 4 years ago., Last updated 6 years ago., Last updated 6 years ago., Last updated 7 years ago., Last updated 7 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago.]", "[Last updated 10 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 9 years ago., Last updated 10 years ago., Last updated 11 years ago., Last updated 10 years ago., Last updated 11 years ago., Last updated 11 years ago.]", "[Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 11 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 12 years ago.]", "[Last updated 12 years ago., Last updated 13 years ago., Last updated 12 years ago., Last updated 12 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 13 years ago., Last updated 14 years ago., Last updated 14 years ago.]", "[Last updated 13 years ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]", "[Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]", "[Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago., Last updated 1 year ago.]"]
  => VAR @updated
ENDBLOCK

names = names
  .SelectMany(n => n.Split(','))
  .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
  .ToList();

updated = updated
  .SelectMany(n => n.Split(','))
  .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
  .ToList();
  
BLOCK:ZipLists
  list1 = @names
  list2 = @updated
  format = "[1]\\r\\n[+] Name = [0]\\r\\n"
  => VAR @zipped
ENDBLOCK

zipped = zipped.Select(i => i.Unescape()).ToList();

BLOCK:FileWriteLines
  path = "test.txt"
  lines = @zipped
ENDBLOCK

Had to use some C# because your lists were malformed…
Don’t get used to this :slight_smile:

2 Likes

Thank You very much, Sir! You are the Best! :smiling_face_with_three_hearts:

zip list works in ob2 native?

Of course it does dude

never worked with me I got 2 list from regex and when I try to put them I got empty result

Oh thanks, I make it work with this loli code

names = names
  .SelectMany(n => n.Split(','))
  .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
  .ToList();

updated = updated
  .SelectMany(n => n.Split(','))
  .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
  .ToList();
1 Like

This is perfect, thanks @Ruri for the examples!