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

2013-01-22 Thread MJang
Folks, I appreciate all of the help! None of the solutions were "perfect" as I discovered (and did not think to provide) some probverbial "corner cases". For my purposes, Scott's egrep -o solution worked best for me, as it made it easier to see those corner cases, such as java servlet expressions,

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

2013-01-21 Thread Paul Heinlein
On Mon, 21 Jan 2013, MJang wrote: Folks, I'd appreciate a bit of help with a text search / sort. I've searched through a repo with a bunch of .java files, listing text associated with *.jsp files. As these are URLs, there's often text before and after the *.jsp. My objective is to set up a

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

2013-01-21 Thread Scott Bigelow
I like David's solution, and that's the general strategy I would try, but I would use grep, which offers a friendly option "-o", a shorthand for what he's trying to do: egrep -o '[^/"]+\.jsp' On Mon, Jan 21, 2013 at 3:20 PM, Rich Shepard wrote: > On Mon, 21 Jan 2013, MJang wrote: > > > My ob

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

2013-01-21 Thread Rich Shepard
On Mon, 21 Jan 2013, david.fl...@mchsi.com wrote: > Assuming your original target list is in a file called file_list: > sed 's,.*[^A-Za-z]\(.*\.jsp\).*,\1,' file_list > extracted_list David, Much more elegant than my awk approach. I'm not as fluent in sed as I am in awk. Thanks for the insig

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

2013-01-21 Thread Rich Shepard
On Mon, 21 Jan 2013, MJang wrote: > My objective is to set up a file with just the *.jsp filenames -- all the > stuff at least before the file name should be deleted on each line. (I can > then sort and compare with a different list of *.jsp filenames) > > Examples in my target list: > > "/path/to

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

2013-01-21 Thread david . fleck
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: >

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

2013-01-21 Thread MJang
Folks, I'd appreciate a bit of help with a text search / sort. I've searched through a repo with a bunch of .java files, listing text associated with *.jsp files. As these are URLs, there's often text before and after the *.jsp. My objective is to set up a file with just the *.jsp filenames -- a