All Projects → dalance → Amber

dalance / Amber

Licence: mit
A code search / replace tool

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Amber

Ripgrep
ripgrep recursively searches directories for a regex pattern while respecting your gitignore
Stars: ✭ 28,564 (+12319.13%)
Mutual labels:  command-line-tool, search, grep
Ff
Find files (ff) by name, fast!
Stars: ✭ 257 (+11.74%)
Mutual labels:  command-line-tool, search
Phpgrep
Syntax-aware grep for PHP code.
Stars: ✭ 185 (-19.57%)
Mutual labels:  search, grep
Rg.el
Emacs search tool based on ripgrep
Stars: ✭ 277 (+20.43%)
Mutual labels:  search, grep
Dategrep
print lines matching a time range
Stars: ✭ 159 (-30.87%)
Mutual labels:  command-line-tool, grep
Simpleaudioindexer
Searching for the occurrence seconds of words/phrases or arbitrary regex patterns within audio files
Stars: ✭ 100 (-56.52%)
Mutual labels:  command-line-tool, search
Ugrep
🔍NEW ugrep v3.1: ultra fast grep with interactive query UI and fuzzy search: search file systems, source code, text, binary files, archives (cpio/tar/pax/zip), compressed files (gz/Z/bz2/lzma/xz/lz4), documents and more. A faster, user-friendly and compatible grep replacement.
Stars: ✭ 626 (+172.17%)
Mutual labels:  search, grep
Astpath
A command-line search utility for Python ASTs using XPath syntax.
Stars: ✭ 167 (-27.39%)
Mutual labels:  command-line-tool, search
Grab
experimental and very fast implementation of a grep
Stars: ✭ 230 (+0%)
Mutual labels:  search, grep
Innodb Java Reader
A library and command-line tool to access MySQL InnoDB data file directly in Java
Stars: ✭ 217 (-5.65%)
Mutual labels:  command-line-tool
Scoper
Fuzzy and semantic search for captioned YouTube videos.
Stars: ✭ 225 (-2.17%)
Mutual labels:  search
Fuzzysort
Fast SublimeText-like fuzzy search for JavaScript.
Stars: ✭ 2,569 (+1016.96%)
Mutual labels:  search
Hiddensearchwithrecyclerview
Simple library to have a hidden/shown search bar
Stars: ✭ 220 (-4.35%)
Mutual labels:  search
Xcparse
Command line tool & Swift framework for parsing Xcode 11+ xcresult
Stars: ✭ 221 (-3.91%)
Mutual labels:  command-line-tool
Search Engine Parser
Lightweight package to query popular search engines and scrape for result titles, links and descriptions
Stars: ✭ 216 (-6.09%)
Mutual labels:  search
Vocabs
📚 A lightweight online dictionary integration to the command line. No browsers. No paperbacks.
Stars: ✭ 226 (-1.74%)
Mutual labels:  command-line-tool
Material Ui Search Bar
Material design search bar
Stars: ✭ 215 (-6.52%)
Mutual labels:  search
Geek Life
The Todo List / Task Manager for Geeks in command line
Stars: ✭ 212 (-7.83%)
Mutual labels:  command-line-tool
Trinity
Trinity IR Infrastructure
Stars: ✭ 227 (-1.3%)
Mutual labels:  search
Engine Mode
Minor mode for defining and querying search engines through Emacs.
Stars: ✭ 225 (-2.17%)
Mutual labels:  search

amber

Actions Status Crates.io codecov

amber is a code search and replace tool written by Rust. This tool is inspired by ack, ag, and other grep-like tools.

Features

Useful default settings

  • Recursively search from the current directory
  • Ignore VCS directories (.git, .hg, .svn, .bzr)
  • Ignore binary files
  • Output by the colored format

Multi-threaded searching

Large files ( > 1MB by default) are divided and searched in parallel.

Interactive replacing

amber can replace a keyword over directories (traditionally by find ... | xargs sed -i '...') . You can decide to do replacing or not interactively.

Installation

Arch Linux

Install the amber-search-git package from AUR.

yaourt -S amber-search-git

Manual

Download from release page, and extract to the directory in PATH.

Usage

Two commands (ambs/ambr) are provided. ambs means "amber search", and ambr means "amber replace". The search keyword is not regular expression by default. If you want to use regular expression, add --regex.

ambs keyword                  // recursively search 'keyword' from the current directory.
ambs keyword path             // recursively search 'keyword' from 'path'.
ambr keyword replacement      // recursively search 'keyword' from the current directory, and replace to 'replacement' interactively.
ambr keyword replacement path // recursively search 'keyword' from 'path', and replace to 'replacement' interactively.

amber replace interactively by default. If the keyword is found, the following prompt is shown, and wait. If you input 'y', 'Y', 'Yes', the keyword is replaced. 'a', 'A', 'All' means replacing all keywords non-interactively.

Replace keyword? ( Yes[Y], No[N], All[A], Quit[Q] ):

If --regex option is enabled, regex captures can be used in replacement of ambr.

$ cat text.txt
aaa bbb
$ ambr --no-interactive --regex '(aaa) (?<pat>bbb)' '$1 $pat ${1} ${pat}' test.txt
$ cat text.txt
aaa bbb aaa bbb

Configuration

Default flags can be configured by ~/.ambs.toml and ~/.ambr.toml. Available entries and default values are below:

regex          = false
column         = false
row            = false
binary         = false
statistics     = false
skipped        = false
interactive    = true
recursive      = true
symlink        = true
color          = true
file           = true
skip_vcs       = true
skip_gitignore = true
fixed_order    = true
parent_ignore  = true

You can choose some entries to override like below:

column = true

Benchmark

Environment

  • CPU: Intel(R) Xeon(R) Gold 6134 CPU @ 3.20GHz
  • MEM: 1.5TB
  • OS : CentOS 7.5

Target Data

Pattern

  • pattern1( many files with many matches ) : 'EXPORT_SYMBOL_GPL' in source1
  • pattern2( many files with few matches ) : 'irq_bypass_register_producer' in source1
  • pattern3( a large file with many matches ) : '検索結果' in source2
  • pattern4( a large file with few matches ) : '"Quick Search"' in source2

Comparison Tools

Benchmarking Tool

hyperfine with the following options.

  • --warmup 3: to load all data on memory.

Result

  • search ( compare_ambs.sh )
pattern amber ripgrep grep
1 212.8ms ( 139% ) 154.1ms ( 100% ) 685.2ms ( 448% )
2 199.7ms ( 132% ) 151.6ms ( 100% ) 678.7ms ( 448% )
3 1.068s ( 100% ) 4.642s ( 434% ) 3.869s ( 362% )
4 1.027s ( 100% ) 4.409s ( 429% ) 3.118s ( 304% )
  • replace ( compare_ambr.sh )
pattern amber fastmod find/sed
1 792.2ms ( 100% ) 1231ms ( 155% ) 155724ms ( 19657% )
2 418.1ms ( 119% ) 352.4ms ( 100% ) 157396ms ( 44663% )
3 18.390s ( 100% ) 74.282s ( 404% ) 639.740s ( 3479% )
4 17.777s ( 100% ) 74.204s ( 417% ) 625.756s ( 3520% )
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].