Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It'd be useful to support regex as a column separator #251

Closed
farcaller opened this issue Jan 4, 2023 · 5 comments · Fixed by #276
Closed

It'd be useful to support regex as a column separator #251

farcaller opened this issue Jan 4, 2023 · 5 comments · Fixed by #276
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@farcaller
Copy link
Contributor

I'm thinking for some option to make px aux|ov -c work in an easy way and honestly I'd prefer some smartness on the ov's side (e.g. to detect basic columns like awk does). Ideally -c alone would match against \s+ as a column separator, but otherwise it'd be useful if a regexp could be a separator at all, as vanilla ps idents with several spaces.

Yes, I know it can be fixed on ps side, but I think it's be a quality-of-life improvement done on the ov side.

@noborus
Copy link
Owner

noborus commented Jan 4, 2023

Thank you.
I think this is a good idea.
However, to implement this, we may need to switch between interpreting it as a delimiter and a regular expression.
For example, if ". " as a delimiter, I am not happy with the need for escaping.

@farcaller
Copy link
Contributor Author

That's very reasonable. I'd think a separate flag would work for a regexp?

@noborus
Copy link
Owner

noborus commented Jan 4, 2023

Hmm, maybe I should implement a switch like search...
Or looking for another good idea.

@noborus
Copy link
Owner

noborus commented Jan 21, 2023

Or looking for another good idea.

It's an idea I came up with.

When using regular expressions, enclose them in /. /regexp/.
/[,|;]/ and /[a-z]/ are treated as regular expressions.
Command line options can be enclosed in double quotes. "/[,|;]/"
"/", "/end" and "s/e" are treated as strings.
If you want to treat "//" as a character string, use "\/\/".

@noborus
Copy link
Owner

noborus commented Mar 25, 2023

I created guesswidth to guess the width of the width format.
This gives better results than using /\s+/ for the column-delimiter.
I plan to introduce this to ov as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants