How to remove path from filename

By using sed, see here:

http://unix.stackexchange.com/questions/16541/remove-slashes-parent-paths-from-filenames-inside-css-and-javascript-content

but the working command is:

sed -e ‘s![/A-Za-z0-9:._-]*/\([A-Za-z0-9:._-]*\.\(png\|jpg\|gif\|tif\|css\)\)!\1!g’

we need to add \1 as replace string.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s