Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

grep lines after match

$ grep -A1 text

-AX tells grep to display 'X' amount of lines after line of match. 
Use -BX to do the same but before.
Comment

grep after match

Include -A flag to add lines after match and -B flag to add lines before
grep match -A 3	#display match line and 3 after lines
grep match -B 2 #display match line and 2 lines before
Comment

PREVIOUS NEXT
Code Example
Shell :: awk field separator multiple characters 
Shell :: awk define string as delimiter 
Shell :: spotify ubuntu 
Shell :: how to clear gradle cache gitignore 
Shell :: visual studio export installed nuget pacjkages 
Shell :: sudo: yum: command not found 
Shell :: find external ip ubuntu 
Shell :: list of created ssh port forwarding 
Shell :: if file not exists 
Shell :: docker image is not reseting 
Shell :: push imagesto docker 
Shell :: sed delete line match 
Shell :: adding to git 
Shell :: git config path 
Shell :: undo git commit after push 
Shell :: rm vs rmdir 
Shell :: terminal show running processes tree mac os 
Shell :: docker compose volumes 
Shell :: bash append to a file 
Shell :: csv to markdown table 
Shell :: pip for pyhton 3.8 
Shell :: find the process ID of a running process bash without pgrep 
Shell :: git get latest log output to file 
Shell :: git apply trailing whitespace 
Shell :: W: GPG error: http://packages.ros.org/ros/ubuntu xenial InRelease: The following signatures were invalid: KEYEXPIRED 1622248854 
Shell :: kubectl jq json pod name jsonpath 
Shell :: ho to autostart chrome on linux boot 
Shell :: files 664 folders 755 
Shell :: unable to locate package php-xmlrpc 
Shell :: cast my phone screen on laptop in arch linux 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =