Hi,

vi test.txt

Code:
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