Workflow Example: Text [Remove First or Last line]

This workflow removes the first or the last line of a string of text. Note that this workflow removes one or the other, not both; though it is certainly possible to do that.

The workflow being by generating a number of unique lines of content (by using a sequence number and some input about how many lines you wish to have). The result is stored in a variable called Content and displayed via a Quick Look action with the full set of lines between double quotes.

You are asked whether you would like to remove the first or the last line of the text.

Rather than using lists and iteratively rebuilding them without the first or last item, we can instead use some carefully crafter regular expressions to remove the first or last line. The result is then shown surrounded in double quotes.

Tags: | workflow |