List Operations
🔗 Original page — Source of this material
Description
❗→ Lists are mainly used for getting lines of data from a text document or file data entries. For example, you have a file with a list of URLs and you need to visit them one by one, or you're parsing some values from a site and need to sort, remove duplicates, and save them to a file (like parsed email addresses).
How do you add a list to a project?
You need to create a List before getting started

How do you add an action to a project?
Right-click and choose Add Action → Lists → List Operations

Or use ❗→ Smart Search.
What is this used for?
- Adding and retrieving list items
- Removing lines and duplicates
- Linking to a file
- Getting the number of lines
- Shuffling
- Sorting values
How do you work with the action?
Select a sublist
Selects a specific part of the list.

- Select the list you want to work with.
- Choose the function.
- Specify where the result will be saved.
- Sublist filter method a) ❗→ Range - set the range of lines to extract. b) Items not containing text - selects all lines not containing the given text; you can use variables. c) Items not matching ❗→ regex - search criteria using ❗→ regex. d) Items containing text - selects values containing the needed text; you can use variables. e) Items matching ❗→ regex - search criteria using ❗→ regex.
- Enter the value for step 4 here.
- Lines that match the criteria will be removed.
- If the ❗→ list is empty, Zennoposter will go down the red branch.
Example
Add data from list
Add data from one list to another.

- Select the list you'll work with
- Choose the function.
- Specify where to take the lines from.
- Where to place the result - *at the end, *at the beginning, *at a position.
- If *at a position is chosen, enter the line number or a variable.
Lines are copied, not removed from the original list.
Example
Add a line
Add a line to a list.

- Select the list you'll work with
- Choose the function.
- Enter the value or variable.
- Where to place the result - *at the end, *at the beginning, *at a position.
- If you chose *at a position, enter the row number or variable.
Add text
Add text to a list.

- Select the list you'll work with
- Choose the function.
- Text or character set to add to the list; you can use a variable.
- Where to place the result - *at the end, *at the beginning, *at a position.
- Add empty lines if the text is missing.
Example
Join list items
Join list items with a separator and optionally save to a variable.
- Select the list you'll work with
- Choose the function.
- Line separator a) *New line - every item will be on a new line. b) *Custom - enter your own text or characters to insert between the list items. c) *From the list settings - uses the separator from ❗→ list settings.
- Variable to save the processed data.
Example
Shuffle list items
Randomly reorder the items in a list.

- Select the list you'll work with
- Choose the function.
Changing the order will not lose any values.
Get number of lines
Get the count of lines in a list.
- Select the list you'll work with
- Choose the function.
- Search criteria (can use a variable): a) All b) Do not contain text c) Do not match ❗→ regex d) With value e) Contain text f) Match ❗→ regex
- Variable to save result.
The variable will always only contain a number.
Example
Get a line
Retrieve a line, with an option to remove it from the list and save to a variable.

- Select the list you'll work with
- Choose the function.
- Line criteria (can use a variable): a) Does not contain text b) Does not match ❗→ regex c) First line d) By number e) Random f) Matches ❗→ regex
- Remove line after extracting
- Variable for saving the value.
Example
Link to a file
Link a list to a file during project execution.

- Select the list you'll work with
- Choose the function.
- Choose a file or specify a variable containing the file path.
- If a file does not exist at the path, ZennoPoster will create it automatically.
Sort
Sort list items in ascending or descending order.

- Select the list you'll work with
- Choose the function.
- Use numeric principle.
- Choose the sort type: *descending or *ascending.
Not all letter or symbol lines can be sorted
Save to file
- Select the list you'll work with
- Choose the function.
- Choose the separator (you can use variables): a) *New line b) *Custom c) *From the list
- Choose the file or specify a variable containing the file path.
- The checkbox lets you either append to the file or overwrite it completely.
Example
Remove duplicates
Remove duplicate lines from a list.
- Select the list you'll work with
- Choose the function.
Processing a file with a large number of lines may take some time.
Remove lines
Remove lines from a list based on specific criteria.
- Select the list you'll work with
- Choose the function.
- Remove lines by criteria (can use variables): a) All b) Not containing text c) Not matching ❗→ regex d) First line e) By numbers (can use ❗→ ranges) f) With value g) Containing text h) Containing only whitespace i) Matching ❗→ regex
Example usage
Suppose you need to go to all pages from a list, collect their titles, and put them in another list.
- Create ❗→ List_1 with the pages and link it to a file ahead of time.
- Remove duplicates to avoid visiting the same page twice.
- Create and link ❗→ List_2 to a file.
- Parse the required info from the pages into ❗→ List_2.
- Remove duplicates.
This way, you can create lists of any information you need for further processing or use.













