util/textselect

README.md in master
Repositories | Summary | Log | Files | README.md | LICENSE

README.md (2218B) download


 1# textselect
 2
 3`textselect` is a command-line utility that allows users to interactively select lines from a text file and optionally execute a command with the selected lines. This can be particularly useful for filtering input before processing it with other tools or scripts.
 4
 5## Features
 6
 7- Interactively select lines from a text file using a curses-based interface.
 8- Save selected lines to an output file.
 9- Execute commands with the selected lines as input.
10
11## Installation
12
13To build `textselect` from source, you'll need a C compiler and the `ncurses` library. Clone the repository and run the following commands:
14
15```sh
16git clone https://github.com/friedelschoen/textselect.git
17cd textselect
18make
19make PREFIX=... install
20```
21
22## Usage
23
24```sh
25textselect [-hnv0] [-o output] <input> [command [args...]]
26```
27
28### Options
29
30- `-h`: Display the help message and exit.
31- `-n`: Keep empty lines which are not selectable.
32- `-o output`: Specify an output file to save the selected lines.
33- `-v`: Invert the selection of lines.
34- `-0`: Print selected lines delimited by a NUL-character.
35
36### Navigation and Selection Keys
37
38- `UP, LEFT`: Move the cursor up.
39- `DOWN, RIGHT`: Move the cursor down.
40- `v`: Invert the selection of lines.
41- `SPACE`: Select or deselect the current line.
42- `ENTER, q`: Quit the selection interface.
43
44### Examples
45
46```sh
47# most simple example, select couple lines from a text-file and print it to the terminal afterwards
48textselect input.txt
49
50# select couple lines from a text-file and save it to a text-file
51textselect -o output.txt
52
53# select couple lines from a text-file and pass these to `lolcat` for some funny output
54textselect input.txt lolcat
55
56# select couple lines from a command and print it to the terminal afterwards (choosing from installed packages in Void Linux)
57textselect <(xbps-query -l)
58
59# select couple lines from a command and execute command with lines as arguments (removing unnecessary packages in Void Linux)
60textselect <(xbps-query -m) xargs xbps-remove
61```
62
63## License
64
65This project is licensed under the zlib License. See the [LICENSE](LICENSE) file for details.
66
67## Contributing
68
69Contributions are welcome! Please open an issue or submit a pull request on GitHub.