Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

sed recursive replace

grep -rl oldtext . | xargs sed -i 's/oldtext/newtext/g'
Comment

sed replace

For using match in sed replacement, just border it with '(' and ')':
echo Before123 | sed 's/Before([0-9]*)/1After/g'
123After	# number is matched withtin '( )' and replaced in '1'
Example with 2 match replacements
echo a_b | sed 's/(^.*)_(.*$)/first is 1 and 2 is after/g'
Comment

PREVIOUS NEXT
Code Example
Shell :: create and run docker registry 
Shell :: pip install mysqlclient 
Shell :: what my ip mac 
Shell :: django cors install 
Shell :: pip install requirements.txt 
Shell :: ubuntu show computer performance from terminal 
Shell :: k8s get current context 
Shell :: bash command check 2 arguments 
Shell :: bash list environment variables 
Shell :: add public key to server 
Shell :: find port and kill 
Shell :: portainer templates 
Shell :: certutil md5 windows 
Shell :: bily-101 github 
Shell :: mac of hide "upgrade now" 
Shell :: warp out files in linux 
Shell :: codepush break native images 
Shell :: using ffmpeg on mac to record screen 
Shell :: Check all memory details 
Shell :: nginx gzip 
Shell :: How to kill all tmux sessions (or at least multiple sessions) from the CLI? 
Shell :: change last commit date 
Shell :: wget ignore if exists 
Shell :: how to make python + docx exe 
Shell :: sudo apt-get update 
Shell :: openjdk 11 install linux 
Shell :: how to scp or ssh to gcp instance 
Shell :: cordova plugin list save 
Shell :: how to commit single / multiple file in git 
Shell :: only show first lines linux 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =