Skip to main content

AltF Flow recipe

Split a comma separated list into lines

To turn comma separated values into a one-per-line list, replace line breaks with commas, split on the comma, trim each item and drop empty ones. This recipe also removes duplicates regardless of case and sorts the result naturally, which is handy for merging tag lists, interest fields or form answers copied from several rows.

  • Free, no sign-up
  • Runs in your browser
  • Nothing uploaded
  • Share recipes as a link

5 steps · runs in your browser · nothing uploaded

Pipeline

  1. Find: \\s*\\n\\s*, Replace with: ,, Regular expression

    5 → 1 lines (-4)
  2. Separator: ,, Trim items

    1 → 16 lines (+15)
  3. Remove all

    16 → 14 lines (-2)
  4. Ignore case and edge spaces

    14 → 8 lines (-6)
  5. Natural (2 before 10)

    8 → 8 lines

5lines22words145chars

8lines13words76chars+3 lines vs input

The 5 steps in this recipe

  1. 1

    Find and replace - Find: \\s*\\n\\s*, Replace with: ,, Regular expression

    Replace text everywhere. Supports regular expressions with $1 back-references.

  2. 2

    Split into lines - Separator: ,, Trim items

    Break text on a separator (comma by default) so each item gets its own line.

  3. 3

    Remove empty lines - Remove all

    Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.

  4. 4

    Remove duplicate lines - Ignore case and edge spaces

    Keep the first copy of each line and drop repeats.

  5. 5

    Sort lines - Natural (2 before 10)

    Sort A to Z, Z to A, naturally (2 before 10), by number or by length.

Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.

Worked example

Before
seo, Email, newsletter,, landing page
email , webinar,SEO
Webinar, case study 2, case study 10
  podcast,newsletter , 
landing page, Case Study 2
After
case study 2
case study 10
Email
landing page
newsletter
podcast
seo
webinar

Why each step is there

  • Replacing line breaks with commas means items from every row are split the same way, and the last item of one row cannot merge with the first of the next.
  • Split into lines with Trim items on removes the spaces around each value.
  • Remove empty lines drops the blanks left by doubled or trailing commas.
  • Remove duplicate lines with Ignore case on keeps the first spelling it sees, so seo and SEO count once.
  • Natural sort puts case study 2 before case study 10.

Other separators

Change the split separator to ; for semicolon lists, | for pipe lists or \t for tab separated values. If values themselves contain commas inside quotes, treat the text as CSV and use the CSV to JSON step instead.

Split a comma list into lines: questions and answers

Which spelling is kept when duplicates differ in case?

The first one in the input. Add Change case before dedupe if you want every item lowercase or Title Case.

Can I go back to a comma list?

Yes. Add Join lines at the end with ", " as the separator.

Does it keep the original order?

Only if you remove the sort step. Dedupe on its own keeps first-seen order.

More recipes like this

Every step you can add (41)

Clean up

  • Trim whitespace
  • Trim every line
  • Remove empty lines
  • Collapse repeated spaces
  • Remove line breaks
  • Strip HTML tags
  • Straighten smart quotes
  • Remove accents
  • Remove punctuation
  • Remove emoji
  • Remove non-ASCII characters

Change case

  • Change case
  • Make URL slugs

Lines

  • Sort lines
  • Remove duplicate lines
  • Keep only duplicated lines
  • Compare with another list
  • Count repeated lines
  • Reverse line order
  • Shuffle lines
  • Keep a range of lines
  • Truncate long lines
  • Wrap at a width
  • Split into lines
  • Join lines

Find and filter

  • Find and replace
  • Filter lines
  • Remove words or characters

Extract

  • Extract

Data and formats

  • Format JSON
  • Minify JSON
  • CSV to JSON
  • JSON to CSV
  • Lines to JSON array
  • JSON array to lines

Encode and decode

  • Encode or decode

Build output

  • Add prefix / suffix
  • Quote each line
  • Number lines
  • Apply a line template
  • Add timestamp
What each step does, with its options

AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.