Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • Should I save this as a separate file in the same directory? I have never done this before. Commented Feb 26, 2015 at 20:34
  • @Vesnog - You can if you like - you can then source it like . ./filename.fn (or whatever you name it). Or you can copy/paste it into your command-line. After doing either thing you'd just call it like glob_hsli. I think I got it ironed out to handle all outside cases now, as well. It will recurse if it needs to get a match for *.*.h5 without also matching *.*.*.h5 - but it will quit as soon as it can regardless. With your above dataset, one iteration should be all it takes. Commented Feb 26, 2015 at 20:37
  • Thanks once again while we are at it I got another file that has some line with a word like reso=35, how can I extract 35 here? Tried glob_hsli and it returns 0. 03.h5 Commented Feb 26, 2015 at 20:43
  • 1
    @Vesnog - sed '/\n/P;//!s/reso=\([0-9]\{1,\}\)/\n\1\n/;D' <file - but you might want to use literal newlines rather than the ns in the right hand side of the s///ubstitution. Look here... Commented Feb 26, 2015 at 20:47
  • 1
    @Vesnog - oh! I get it. I do think it should glob .15 before in order before .03, but if not we can explicitly test for that. It's not so hard. Commented Feb 26, 2015 at 21:28