Ya know, that looks an awful lot like one of the solutions I posted. Just saying. :)
Also you can get rid of the -n and the /p - they cancel each other out in this case.
sed 's/^ *//'
Sed reads in its input a line at a time, runs the given transformations on each line, and prints out the result.
s/^. *// says to substitute the empty string for any number of spaces at the start of the line.
s/old/new/ -> replace first occurrence of "old" on the line with "new"
Old is actually a pattern, not a string; some characters are special:
^ matches the start of the line
space isn't special - it just matches itself
space * matches any number of spaces
Nothing between the middle and last / means the text that matches is replaced with nothing - that is, removed.
Sent from my iPhone
On Jul 28, 2011, at 13:35, "Zavatone, Alex" <
email@hidden> wrote:
You sir, are a benefit to humanity.
Now, how can I find out why that does what that does?
Any good guides to get started?
Danke.
On Jul 25, 2011, at 2:20 PM, Christopher Stone wrote:
on trimLeadingWhiteSpace(str)
set cmd to "sed -nE 's/^[ ]*//p'<<<" & quoted form of str
do shell script cmd
return result
end trimLeadingWhiteSpace
This email message and any attachments are for the sole use of the intended recipient(s) and may contain information that is proprietary to U.S. Foodservice, Inc and/or its subsidiaries or otherwise confidential or legally privileged. If you have received this message in error, please notify the sender by reply, and delete all copies of this message and any attachments. If you are the intended recipient you may use the information contained in this message and any files attached to this message only as authorized by U.S. Foodservice. Files attached to this message may only be transmitted using secure systems and appropriate means of encryption, and must be secured using the same level password and security protection with which the file was provided to you. Any unauthorized use, dissemination or disclosure of this message or it's attachments is strictly prohibited.