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 line 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 :: how to download virtualbox on kali linux 
Shell :: awk field separator 
Shell :: install spotify on ubuntu 
Shell :: npm install postgresql 
Shell :: git folder 
Shell :: ubuntu set vi as default editor 
Shell :: terminal run sh file 
Shell :: installing font awesome brand icons 
Shell :: install wordpress on centos 7 
Shell :: delete branch gitlab 
Shell :: bash print a blank line 
Shell :: how to install kite on manjero 
Shell :: bash exit code 
Shell :: nvm node 
Shell :: sequence of png images to mp4 
Shell :: debian restart service 
Shell :: copy to clipboard over ssh 
Shell :: linux grep 
Shell :: ionic capacitor ios 
Shell :: linux zip folder without parent folder 
Shell :: poetry delete environment 
Shell :: skip ci gitlab 
Shell :: git flow sourcetree command 
Shell :: bash script to get all git branches from remote 
Shell :: remote: Permission to asfand005/test.git denied to asfand87. 
Shell :: add user to sudoer "zsh" same customization for root 
Shell :: openssl error with ruby 2.3.4 in ubuntu 
Shell :: libbre office ubuntu 
Shell :: brew install older version opencv 
Shell :: install laravel installer on fish shell 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =