[TxMt] Replacement pattern for TM_DROPPED_FILE_PATH

marios tmtxpstuff at consking.com
Mon Oct 30 20:23:29 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a case, where I would like to retain the Directory Name of the
File being dropped.

In that case, the TM_DROPPED_FILEPATH variable has the following value:

/Users/username/Sites/siteroot/public_html/textpattern/_templates/articles/article/60.an-example-article.txaml

I want to retain the last directory name, in this case: article.

I tried :

section=`echo $TM_DROPPED_FILE_PATH | perl -pe
's/(.*)?(\/)(\w+)(\/)([\d+]+)(\.)(.*)$/$3/g'`
echo "$section"

But the variable doesn't echo anything.

I tested the replacement pattern with find and replace and it gives me
what I want.

What am I doing wrong here ?

Any help appreciated.

regards, marios
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: This might change in the future
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFRl9B8tSzPOYuZvQRAsvoAJ9AvdJnQlXWIgOEtD1ppcNWAF/1IQCcC/jK
UbfVsF2g0QZwSwMx9WnqKRw=
=qDyr
-----END PGP SIGNATURE-----



More information about the textmate mailing list