You might wish to investigate the GNU idutils toolkit. On a local copy of the Linux kernel sources, it can give output like this:
$ gid ugly
include / linux / hil_mlc.h: 66: * a positive
return value causes the "ugly"
branch to be taken.
include / linux / hil_mlc.h: 101: int ugly; /* Node to jump to on timeout */
Rebuilding the index from a cold cache is reasonably quick:
$ time mkid real 1 m33 .022 s user 0 m17 .360 s sys 0 m2 .730 s
Rebuilding the index from a warm cache is much faster:
$ time mkid real 0 m15 .692 s user 0 m15 .070 s sys 0 m0 .520 s
On a cold cache, git grep foo
(which returned 1656 entries, far more than idutils):
$ time git grep foo > /dev/null
real 0 m19 .231 s
user 0 m1 .480 s
sys 0 m0 .680 s
Once the cache was warm, git grep foo
runs much faster:
$ time git grep foo > /dev/null
real 0 m0 .264 s
user 0 m1 .320 s
sys 0 m0 .330 s
The command line client works like this:
ws - update - b--index my.idx datadir # build the index
ws - update - b--append--index my.idx datadir # incremental update
ws--index my.idx hello world # query the index
copy text with space to enter visual mode, then select text, then use y to yank, then hit Enter,An Introduction to the Command-Line (on Unix-like systems) - Using the Python Shell to do Math
command - f
command--flag
adding contents of file r for entire file R for line by line ,This filtering is much like using grep, head and tail commands in many ways and there are even more features Use sed for inplace editing, the filtered lines to be transformed etc. Not as substitute for those commands ,By default, sed prints every input line, including any changes made by commands like substitution printing here refers to line being part of sed output which may be shown on terminal, redirected to file, etc ,Use sed for inplace editing, the filtered lines to be transformed etc. Not as substitute for those commands
$ sed--version | head - n1 sed(GNU sed) 4.2 .2 $ man sed SED(1) User Commands SED(1) NAME sed - stream editor for filtering and transforming text SYNOPSIS sed[OPTION]...{ script - only - if -no - other - script } [input - file]... DESCRIPTION Sed is a stream editor.A stream editor is used to perform basic text transformations on an input stream(a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits(such as ed), sed works by making only one pass over the input(s), and is consequently more efficient.But it is sed 's ability to filter text in a pipeline which particularly distinguishes it from other types of editors. ...
Detailed examples for substitute command will be covered in later sections, syntax is
s / REGEXP / REPLACEMENT / FLAGS
$ # sample command output to be edited $ seq 10 | paste - sd, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 $ # change only first ',' to ' : ' $ seq 10 | paste - sd, | sed 's/,/ : /' 1: 2, 3, 4, 5, 6, 7, 8, 9, 10 $ # change all ',' to ' : ' by using 'g' modifier $ seq 10 | paste - sd, | sed 's/,/ : /g' 1: 2: 3: 4: 5: 6: 7: 8: 9: 10
- When extension is given, the original input file is preserved with name changed according to extension provided
$ # '.bkp' is extension provided $ sed - i.bkp 's/Hi/Hello/' greeting.txt $ # output from sed is written back to 'greeting.txt' $ cat greeting.txt Hello there Have a nice day $ # original file is preserved in 'greeting.txt.bkp' $ cat greeting.txt.bkp Hi there Have a nice day
- Use this option with caution, changes made cannot be undone
$ sed - i 's/nice day/safe journey/' greeting.txt $ # note, 'Hi' was already changed to 'Hello' in previous example $ cat greeting.txt Hello there Have a safe journey