command to find and delete line in single shot.
i have a file in solaris. In which i want to delete line whenever it find "able to delete" sentence at single shot. Is there any awk command or some command to satisfy my need.
file: i have to delete this line i am not able to DELETE this line i am not able to DE LETE this line able TO delete this line finding the command. |
sed is probably the best tool to use here. Deleting a line containing a set pattern is an easy thing to do with it.
Here are a few useful sed references. http://www.grymoire.com/Unix/Sed.html http://sed.sourceforge.net/grabbag/ http://sed.sourceforge.net/sedfaq.html http://sed.sourceforge.net/sed1line.txt Recognize that the version of sed you use on solaris likely has some differences to the gnu sed used on Linux. gnu has added a lot of features like the -i edit in place option that yours probably won't have. It's generally better if you have some knowledge of regular expressions too. grep -v is another possible option. |
You can do that with a combination of find, grep, sed and a little shell program (you do use KornShell, right?).
Code:
#!/bin/ksh Hope this helps some. |
Thank you its working fine for me. :)
|
All times are GMT -5. The time now is 07:18 PM. |