I'm writing a Shellscript and would like to write a way to remove the exact matching characters specified in sed.
sed
sed -i -e '/^1.1.1.1$/d' test.txt
Original file
1.1.1.100
1.1.1.1
After sed
1.1.1.100
1.1.1.1 disappears. If you don't specify the beginning and end with the regular expression ^ $, the characters containing 1.1.1.1 will disappear. Therefore, if ^ $ is not specified, the above 1.1.1.100 will also disappear. Option description below -i Edit files directly GNU system only -e Add a script (command) The / d d command deletes a line.
Regular expressions ^ First string $ Last string
Check here for command details
Recommended Posts