You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might not be feasible, but I'd really like to be able to select rightmost/trailing fields from each line.
My use-case is for flattening an arbitrarily nested tree of files, where I only care about the parent directory and the filename of the files.
I want to generate the following output by selecting the 2 rightmost fiels from this input stream when splitting on / and joining on _ (i.e. quivalent to hck -d/ -D_ ...)
b_c.jpg
d_e.jpg
d_f.jpg
h_i.jpg
g_j.jpg
a_k.jpg
Would this be feasible? I can think of a couple signifiers for the potential option flag if it is, but my preference would be +f 2,1 (i.e. an inverted -f).
The text was updated successfully, but these errors were encountered:
I think this should be doable - I don't have bandwidth to do this right this second, but will try to work it in at a future point.
(writing this out for future self of anyone inspired enough to do a PR)
Within hck there are a few different code-paths to parsing lines based on the parameters chosen, with different levels of optimization applied to each. An inverted -f will need its own set of codepaths, one for the regex delimiter and one for the substr literal delimiter that reverses the input string before splitting (or figure out how to .rev the split iterator. See https://github.com/sstadick/hck/blob/master/src/lib/line_parser.rs
It may be tricky to specify output order... but also doable.
This might not be feasible, but I'd really like to be able to select rightmost/trailing fields from each line.
My use-case is for flattening an arbitrarily nested tree of files, where I only care about the parent directory and the filename of the files.
EX: Imagine this is the file structure
If I ran
find ./a -type f -regex '.*\.jpg'
on in the parent ofa/
it would produce this output:I want to generate the following output by selecting the 2 rightmost fiels from this input stream when splitting on
/
and joining on_
(i.e. quivalent tohck -d/ -D_ ...
)Would this be feasible? I can think of a couple signifiers for the potential option flag if it is, but my preference would be
+f 2,1
(i.e. an inverted-f
).The text was updated successfully, but these errors were encountered: