https://github.com/tomasfn87/bci
Download Linux CLI tool here! - Search Script for Bash
https://github.com/tomasfn87/bci
grep linux-cli linux-shell search
Last synced: 11 months ago
JSON representation
Download Linux CLI tool here! - Search Script for Bash
- Host: GitHub
- URL: https://github.com/tomasfn87/bci
- Owner: tomasfn87
- Created: 2021-09-28T02:16:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-06T22:08:57.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T01:48:21.365Z (about 1 year ago)
- Topics: grep, linux-cli, linux-shell, search
- Language: Shell
- Homepage:
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `bci` / `gbci`
## *Search Script for* `GNU/Linux`
- `bci` and `gbci` use `egrep` and `grep` to show a list a of files that contain a piece of text, showing the user a pretty colored output;
- the first element of each line of a sucessfull search is the number of ocurrences, and the second is the filepath where the specified text was found;
- if the specified directory doesn't exists, a corresponding **Error** message will be thrown.
---
- Get this CLI tool for your `Linux` distro by using the `install` command below;
- Two new commands will be at your disposal:
- `bci`;
- `gbci`.
- They work the same way, but `bci` output is __red__;
- In case you prefer a more *__Old School__* style, `gbci` stands for *__green__* `bci`; it's also useful when further refining the search with `grep`, whose highlighting is already red.
---
## Commands
### *Install*:
```shell
sudo git clone --depth 1 --no-checkout https://github.com/tomasfn87/bci /usr/local/lib/bci && pushd /usr/local/lib/bci && sudo git sparse-checkout set {g,}bci.sh && sudo git checkout && sudo ln -rs /usr/local/lib/bci/bci.sh /usr/local/bin/bci && sudo ln -rs /usr/local/lib/bci/gbci.sh /usr/local/bin/gbci && popd && echo "\nUse commands bci and gbci to search through the files' content in a directory."
```
### *Uninstall*:
```shell
sudo rm -rf /usr/local/{lib/bci,bin/{g,}bci}
```
### *Update*:
```shell
sudo rm -rf /usr/local/lib/bci && sudo git clone --depth 1 --no-checkout https://github.com/tomasfn87/bci /usr/local/lib/bci && pushd /usr/local/lib/bci && sudo git sparse-checkout set {g,}bci.sh && sudo git checkout && popd && echo "\nbci and gbci were updated to the latest version."
```
---
## Arguments
- `SEARCH_TERM`: _the 1st argument is the_ SEARCH TERM _that will be searched inside all the files available_;
- `SEARCH_DIRECTORY`: _the 2nd argument is the_ SEARCH DIRECTORY _where the search will take place_.
---
## _Examples_:
*Basic operations*:
```shell
bci 'import datetime as dt' ~/python
```
*Search for* `import datetime as dt` *into folder* `~/python`
```shell
gbci export\ default /home/user/mySite
```
*Search for* `export default` *into folder* `/home/user/mySite`
---
*Further refining the search*:
```shell
gbci export\ default /home/user/mySite | grep \\.ts
# or
gbci "export default" /home/user/mySite | grep \\.\[jt\]s
```
- *Refine the search further by piping* `grep`;
- *Works better with* `gbci` *because* `grep` *uses* **red** *to mark the returned results*.