Search
Wednesday
Jul082015

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.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>