Created
December 10, 2024 19:24
-
-
Save chriseaton/e62f4185666830f91e6c2df0a800f2ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use grep to search the output of the file for specific terms. | |
# the `-n` flag will output line numbers to the left of matches. | |
cat some.log | grep -n "Looking for..." | |
# you can then use the line number to find the entries on and around the entry. | |
# Note the line-number is used, as well as a count to includes a number of lines after. | |
# In this example, we're looking at lines starting at 3176101 and the +10 lines after. | |
sed -n '3176101,+10p' app.log | |
# OTHER | |
# need a solid sed cheatsheet? Check this out: https://edoras.sdsu.edu/doc/sed-oneliners.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment