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

Add a simple read/parse plugin to better handle text data #889

Merged
merged 1 commit into from Oct 29, 2019

Conversation

sophiajt
Copy link
Member

This adds a simple read plugin which can handle a matching pattern. The pattern describes how to handle the text data and convert it to a table.

Let's say we had the following file:

VAR1=Chill
VAR2=StupidLongName
VAR3=AlsoChill

Usually, we would turn this into a table using:

open file.txt | lines | split-columns "=" Name Value

With this new command, we can instead give a simple pattern that the data must match. If it does, we take the row of text and convert it to structured data:

open file.txt | read "{Name}={Value}"

The {Name} and {Value} denote where the columns of those names will get their data.

If a line does not match the pattern, its data is not included in the table.

@gitpod-io
Copy link

gitpod-io bot commented Oct 29, 2019

@sophiajt sophiajt merged commit 26f40dc into nushell:master Oct 29, 2019
@sophiajt sophiajt deleted the read_plugin branch October 29, 2019 23:15
BurNiinTRee added a commit to BurNiinTRee/nushell that referenced this pull request Nov 8, 2019
The nu_plugin_match binary wasn't built anymore
after the regex dependency was made non-optional in
nushell#889, causing
the removal of the regex feature, which nu_plugin_match
depended on.
bobhy pushed a commit to bobhy/nushell that referenced this pull request Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant