Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

replace using sed

#on my mac
sed -i -e 's/old-text/new-text/g' text.txt
Comment

replace tab sed

sed -i.bak $'s/	/  /' file.txt	#replace tab with sed command
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 :: pipi ungrade 
Shell :: use a specific version of node 
Shell :: restore git stash 
Shell :: install vault 
Shell :: start scipt at startup ubuntu 
Shell :: grep if 
Shell :: ansible run multiple shell commands 
Shell :: git add, commit and push in one command 
Shell :: gitignore folder 
Shell :: path/to/sdkmanager --install "cmdline-tools;latest" 
Shell :: expo install package version 
Shell :: how to navigate to a folder in cmd windows 10 
Shell :: git merge branch to another branch 
Shell :: git refresh .gitignore 
Shell :: docker image prune 
Shell :: best code editors 2022 
Shell :: powershell copy file content to clipboard 
Shell :: install couchdb ubuntu 18.04 
Shell :: pacman purge 
Shell :: linux ping latency print on screen .sh file 
Shell :: To install Scrapy on Ubuntu (or Ubuntu-based) systems 
Shell :: docker command to login with user name and pass word 
Shell :: how to install snapd on ubuntu 
Shell :: how to check open vpn on ubuntu 
Shell :: Pull Ubuntu image 
Shell :: if float less than bash 
Shell :: check port status linux 
Shell :: bat restart printer spooler 
Shell :: use mock api 
Shell :: find all occurrence in directory linux 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =