The following strings are in an html file that is a subset of the strings I have to work with:
content/css/dashboard.css
content/pages/icon-apache.png
content/js/dashboard-commons.js
sbadmin2-1.0.7/bower_components/jquery/dist/jquery.min.js
I'm trying to remove all the path and only leave the file name, so it would be like this:
dashboard.css
icon-apache.png
dashboard-commons.js
jquery.min.js
I'm trying to find an approach that doesn't involve just getting all cases one by one and use sed
to replace it, but a generic way to do it.
In short:
- A regex to find the pattern (multi-level directory path) in the html file and remove it
Edit: I'm looking for a solution that works on linux, preferably that doesn't involves scripting or installing tools.
Edit 2: this question partially answers my question. With the answer provided there, I can now get the last part of the path. But I'm still looking for a regex pattern for extracting the list of strings from the html file.
Edit 3: As requested, here are a few examples:
<link href="sbadmin2-1.0.7/dist/css/sb-admin-2.css" rel="stylesheet">
<link href="content/css/dashboard.css" rel="stylesheet">
<link href="content/css/theme.blue.css" rel="stylesheet">
<script src="sbadmin2-1.0.7/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="sbadmin2-1.0.7/bower_components/flot/excanvas.min.js"></script>
<script src="sbadmin2-1.0.7/bower_components/flot/jquery.flot.js"></script>