[LINUX] How to delete the specified string with the sed command! !! !!

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

result

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

How to delete the specified string with the sed command! !! !!
How to Delete with SQLAlchemy?
How to return to the previous directory with the Bash cd command
How to execute the sed command many times using the for statement
[Introduction to Python] How to split a character string with the split function
How to make a command to read the configuration file with pyramid
[Linux] How to use the echo command
How to use the Linux grep command
How to monitor the execution status of sqlldr with the pv command
How to use CUT command (with sample)
[Introduction to Python] How to write a character string with the format function
How to selectively delete past tweets with Tweepy
How to specify the NIC to scan with amazon-dash
How to delete log with Docker, not to collect log
How to try the friends-of-friends algorithm with pyfof
How to Learn Kaldi with the JUST Corpus
Zip-compress any file with the [shell] command to create a file and delete the original file.
How to create an article from the command line
How to convert / restore a string with [] in python
How to write a GUI using the maya command
[Introduction to Python] How to iterate with the range function?
How to create a submenu with the [Blender] plugin
[Python] How to specify the download location with youtube-dl
Linux user addition, how to use the useradd command
How to use the grep command and frequent samples
[Python] How to rewrite the table style with python-pptx [python-pptx]
(Remember quickly) How to use the LINUX command line
How to use the grep command to recursively search directories and files to a specified depth
How to start the code written in Atom with one command without starting teminal
How to use the generator
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to use the decorator
[systemd] Command to delete service
How to increase the axis
How to start the program
I tried to simulate how the infection spreads with Python
[Ubuntu] How to delete the entire contents of a directory
How to manipulate the DOM in an iframe with Selenium
A story about how to deal with the CORS problem
How to get into the python development environment with Vagrant
In Django, how to abbreviate the long displayed string as ....
[Introduction to Python] How to get data with the listdir function
How to connect the contents of a list into a string
How to display a specified line of a file or command result on Linux (sed, awk)
How to cancel RT with tweepy
How to calculate the autocorrelation coefficient
Replace / delete special symbols with sed
How to use the zip function
[sh] How to store the command execution result in a variable
How to use the optparse module
How to get the ID of Type2Tag NXP NTAG213 with nfcpy
[EC2] How to install chrome and the contents of each command
How to use virtualenv with PowerShell
How to deal with imbalanced data
How to install python-pip with ubuntu20.04LTS
How to deal with imbalanced data
How to get a string from a command line argument in python