Feature request: see N context lines around matches
See original GitHub issueI recently missed a couple of times the -A/B/C argument of grep (but then for “bh”): finding lines around my target command (when I don’t remember some new command but I do remember ssh
was called before).
A: n lines before match B: n lines after match C: n lines before and after match
Example: grep -r -C 5 “test” .
--
--
./new.py-
./new.py-from sqlalchemy import create_engine, MetaData, Table, Column
./new.py-from sqlalchemy import Integer, Unicode, UnicodeText
./new.py-from sqlalchemy import ForeignKey
./new.py-
./new.py:engine = create_engine("postgresql://postgres@localhost/test")
./new.py-
./new.py-metadata = MetaData()
./new.py-
./new.py-countries_table = Table("countries", metadata,
./new.py- Column("id", Integer, primary_key=True),
Notice the line with “test” and 5 lines before and after. It uses – two times to delimit multiple matches. I’m indeed missing colors on the “test” match, I had to specifically add --color=always|auto flag. It would be nice to be the default to use colors I guess.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Keep selection after `clear-query` (to see original context of ...
Problem / Steps to reproduce ... Use Case: a) filter ('search') a list by entering a query; b) have matches; c) then I...
Read more >[Feature Request] Show only differences (with context) - GitLab
When comparing large files with a few differences, it would be very useful to hide matching lines and show only the lines that...
Read more >Visual Studio Code - Include context in search results
View lines of context surrounding a result. Persist results to disk to be referenced later or even tracked in SCM. We will be...
Read more >Show context around old Teams messages from search results
When I search for a certain keyword - say, "hot dog" - I get results that are both old and recent from past...
Read more >when clause contexts | Visual Studio Code Extension API
when clause contexts. Visual Studio Code sets various context keys and specific values depending on what elements are visible and active in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Wow, this has been a long time. I still find myself wanting this very much: just a little peek around a selected command. The better implementation would probably to use it as an extra option in interactive? After you’ve selected a command, enter a second selection of the commands around this. It’s very crucial, as sometimes you want to know for example to which directory you’ve moved or something before executing a command, or know what other steps you took.
Thanks my friend, still an active user of bashhub every day 😃
@DanEdens and @rcaloras thanks a lot, it’s great to know next time I can easily then filter on timestamp/session!