Files
Read the file’s initial contents
Output
0.59.0
Make the edit to the version number and save it.
> open Cargo.toml | upsert package.version { |p| $p | get package.version | inc --patch } | save Cargo.toml
Output none
View the changes we made to the file.
> open Cargo.toml | get package.version
Output
0.59.1
You can parse it into a table.
Output
━━━┯━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━
# │ Band │ Album │ Year
───┼────────┼────────────────────────┼──────
0 │ Fugazi │ 7 Songs │ 1988
1 │ Fugazi │ Repeater │ 1990
4 │ Fugazi │ The Argument │ 2001
━━━┷━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━
You can alternatively do this using parse
.
Or, you can utilize the headers
command to use the first row as a header row like. The only difference would be the headers would match the case of the text file. So, in this case, the headers would be lowercase.
> open bands.txt | lines | split column ":" | headers | sort-by year
> rg -c Value | lines | split column ":" file line_count | into int line_count | sort-by line_count | reverse
Output