Answers for "sed find and replace space"

2

sed replace number of variable length

Just use one of following commands for replacing a number of:
sed "s/[0-9]//" f.txt	#One single digit as 1
sed "s/[0-9]\+//" f.txt #Further digits as 837, specifying match repetition "\+"
sed "s/[0-9\+\.[0-9]\+]//" file.txt #Float type with decimals
Posted by: Guest on October-24-2020
3

sed replace with variable

Just concatenate var '"$var"' to replace values string in sed command:
$ sed -i 's/string_to_replace/'"$var"'/g' file_to_replace.txt
Posted by: Guest on November-03-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language