How Do I Delete a Matching Pattern in Unix?
Contents How Do I Remove a Unix Pattern? Where, Options Are as Follows: -Name “File-to-Find”: File Pattern. -Exec Rm -Rf {}; : Delete All Files Matched by File...
Contents
How do I remove a Unix pattern?
Where, options are as follows:
- -name “FILE-TO-FIND” : File pattern.
- -exec rm -rf {} ; : Delete all files matched by file pattern.
- -type f : Only match files and do not include directory names.
- -type d : Only match dirs and do not include files names.
How do I get rid of matching lines in Linux?
To begin with, if you want to delete a line containing the keyword, you would run sed as shown below. Similarly, you could run the sed command with option -n and negated p , (! p) command. To delete lines containing multiple keywords, for example to delete lines with the keyword green or lines with keyword violet.