Stephen_C Posted March 27 Share Posted March 27 I have spent a day and a half wrestling with a new workflow which involves: extracting part of the path of a file; adding some text in the workflow; and putting the two together to form a link of sorts. Everything is so near to working but I am haunted by a rogue newline which appears as part of the first bullet point (and also happens if I try to achieve the same result using AppleScript). I have tried absolutely everything to dispose of it—short of an axe—but insanity now looms. If you wish to rescue me or laugh at my incompetence here is a transfer.sh link to a short workflow that demonstrates the problem. I despair… Stephen Link to comment
Stephen_C Posted March 27 Author Share Posted March 27 …and, just in case anyone (rightly) thinks this is all down to my incompetence with the command line (I've awked and seded until I'm blue in the face—with the same problem) here's an AppleScript example that demonstrates the identical problem: transfer.sh link. Stephen Link to comment
vitor Posted March 27 Share Posted March 27 (edited) AppleScript always adds a newline at the end, so you’ll have no luck there. It is possible to avoid the newline but it’s a bit of a convoluted solution in which you have to invoke the Objective-C bridge. As for the shell code, you can append | tr -d '\n' which will delete all newlines. But in both cases you could also use a Transform Utility—its default is to trim whitespace, which includes stripping newlines from the ends. Edited March 27 by vitor Link to comment
Stephen_C Posted March 28 Author Share Posted March 28 Many thanks for the kind help, Vitor. Sanity is restored. I'd messed around with the tr command but incompetence prevented it from providing a solution. I had entirely forgotten the Transform Utility <sigh>. As a reward for your kindness you will receive a free copy of the completed workflow… Oh, wait…all my workflows are free: sorry! 😀 Stephen Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now