sandy1028 Posted February 19, 2010 Share Posted February 19, 2010 vi test.txt sun sun moon star moon Now when I execute the command, cat test.txt | grep sun > sun.txt text "sun" is copied to a file. I need a help how to delete the lines which has "sun" from text.txt and save the file. Quote Link to comment https://forums.phpfreaks.com/topic/192639-delete-lines-from-text-file-after-copying-to-a-another-file/ Share on other sites More sharing options...
steviewdr Posted February 19, 2010 Share Posted February 19, 2010 cat text.txt | grep sun > sun.txt | sed -i "/sun/d" text.txt -steve Quote Link to comment https://forums.phpfreaks.com/topic/192639-delete-lines-from-text-file-after-copying-to-a-another-file/#findComment-1014875 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.