[PLUG] sorting by filename, when there's stuff before and after

david.fleck at mchsi.com david.fleck at mchsi.com
Mon Jan 21 23:10:05 UTC 2013


MJang wrote:
>
> Examples in my target list:
>
> "/path/to/file/abc.jsp";
> some java declarative VARIABLE = "something.jsp";
> * other/path/whatever.jsp
> = "/path/to/file/other.jsp";
> "/messy/path/abTestRest.jsp?metasomething=" +
>
> Ideally, from whatever I run, I'd get the following output:
>
> abc.jsp
> something.jsp
> whatever.jsp
> other.jsp
> abTestRest.jsp
>
> Help will be appreciated.

Assuming your original target list is in a file called file_list:

sed 's,.*[^A-Za-z]\(.*\.jsp\).*,\1,' file_list > extracted_list

E.g.:

#cat file_list
"/path/to/file/abc.jsp";
some java declarative VARIABLE = "something.jsp";
* other/path/whatever.jsp
= "/path/to/file/other.jsp";
"/messy/path/abTestRest.jsp?metasomething=" +

#sed 's,.*[^A-Za-z]\(.*\.jsp\).*,\1,' < file_list
abc.jsp
something.jsp
whatever.jsp
other.jsp
abTestRest.jsp



More information about the PLUG mailing list