{"id":21929054,"url":"https://github.com/jreybert/cgvg","last_synced_at":"2026-04-16T01:32:50.782Z","repository":{"id":1855263,"uuid":"2780046","full_name":"jreybert/cgvg","owner":"jreybert","description":"New features in cgvg","archived":false,"fork":false,"pushed_at":"2011-11-15T13:18:18.000Z","size":132,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-29T09:30:56.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"osmc/osmc","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jreybert.png","metadata":{"files":{"readme":"README","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-15T13:09:30.000Z","updated_at":"2022-06-19T16:26:15.000Z","dependencies_parsed_at":"2022-08-20T09:31:07.325Z","dependency_job_id":null,"html_url":"https://github.com/jreybert/cgvg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jreybert/cgvg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreybert%2Fcgvg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreybert%2Fcgvg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreybert%2Fcgvg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreybert%2Fcgvg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jreybert","download_url":"https://codeload.github.com/jreybert/cgvg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jreybert%2Fcgvg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31867710,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T22:29:10.053Z","updated_at":"2026-04-16T01:32:50.755Z","avatar_url":"https://github.com/jreybert.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Code Grep and Vi Grepped\ncg, vg - tools for finding and modifying on keywords\nJoshua Uziel \u003cuzi@uzix.org\u003e - March 13, 2002 - version 1.6.2\n\n[Note: the below is historical... SCO released cscope under a BSD\nlicense several months ago (http://cscope.sourceforge.net/), which\nI also work on.  This doesn't mean cgvg isn't useful anymore... I\npersonally still use it, and I'm happy to have it... maybe you'll\nfind use in it as well.]\n\nAll too often I need to dig through source code.  Where something\nis defined, used, what files, etc.  There's a great tool for doing\nthis from AT\u0026T called \"cscope\" and a very alpha free clone of it\ncalled \"cs\" (that doesn't look like it's being actively worked\non) that does this.  There are some alternatives... like ctags\nand etags for instance... but these only take you to where something\nis defined... not wherever it is used, which makes it frustrating\nwhen, for example, you're at the definition of a function and\ninstead want to see who and what use that function.\n\nSo, as a quick hack, mostly for myself, I started writing up some \nperl scripts (I consciously chose perl, but considered other \nlanguages first).  One script, \"cg\", does the equivalent of a find\nand grep, storing matches and then displaying it in a human-friendly\nmanner.  Run it like so:\n\n[11:14pm] tux:/usr/src/linux/fs\u003e cg ext2_permission\n0 ext2/acl.c   22 * ext2_permission ()\n1 ext2/acl.c   26 int ext2_permission (struct inode * inode, int mask)\n2 ext2/dir.c   74 ext2_permission,        /* permission */\n3 ext2/file.c 102 ext2_permission,        /* permission */\n\nSo, you see in the first column, we have a count, the second column\nis the filename, the third column is the line number, and after that\nis what it found on that line.  This gets stored in your home directory\nin a log file, so that if you want to see it again, all you have to\ndo is type \"cg\" to view it again.  Also stored in the first line is\nthe pwd of where your inquiry was run from, so you that won't have\nto be there to do the second half of this kit.\n\nThere are several ways of running \"cg\".  Again, \"cg\" alone recalls the\nlast search.  You can also run it like \"cg pattern\", and it'll search\nrecursively for all default patterns.  To that, you can add arguments\nlike \"-i\" for case insensitive like \"cg -i pattern\".  If you don't want\nto use the default searching, you can specify where to search and run\nlike grep(1).  For example, running \"cg pattern '*.c'\" will check all .c\nfiles recursively.  If you want to search all files, you can use \"cg\npattern '*'\".  Note that the quotes (single or double, it doesn't\nmatter) are recommended because otherwise the shell expands it before it\ngets to perl, so the search would not be recursive.  It of course works\nlike this as well.  This script also supports coloring and bolding options\nwhich are both hardcoded and customizable per-user with a ~/.cgvgrc file.\n\nAlso among \"cg\"'s capabilities is a \"colon mode\" for printing\nas well as a built-in pager.  The pager allows for colors while\npaging (that \"more\" or \"less\" can't deal with), as well as allowing\none to go back or launch an editor directly using our other script...\n\nThe other script is called \"vg\" and opens an editor on what has been \ngrepped (most editors work).  So remember that count?  All you\nhave to do is run \"vg count\" and it'll fire off a editor in that file\nand at that line number.  So, in our example, running \"vg 1\" would\nopen up an editing session on fs/ext2/acl.c at line 26.\n\nIt is the storing of the query in the logfiles that allows cg and vg\nto work together.  Also, the reason for the ability to see the\nresults of the previous query is there because we can, and because\nquite often you may want to revisit the last query, so why do an\nexpensive grep operation again?  The logfile is stored in a file\nof the form $HOSTNAME.shell_pid in your ~/.cgvg/ directory.  This\nis so that different shells will have different logs.  Also, a\nsymbolic link to your last search is kept as ~/.cglast, and any\nterminal that doesn't have a log associated with it will default\nto the last search.  Using the last log instead of the one with\nthe present terminal is doable with the '-l' option.\n\nNow true that these scripts are very much hacks, but they at least\nprovide me with the functionality that I was looking for in a very\nsmal amount of time.  They're not as feature-rich or precise as\ncscope is, but at the same time are simple to use and are not\nlanguage-specific (cscope only knows C and not C++, java or perl\nfor example).\n\nUsed with something like ctags, this can hopefully save you a lot\nof time.  Feel free to send me comments or suggestions...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjreybert%2Fcgvg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjreybert%2Fcgvg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjreybert%2Fcgvg/lists"}