How to write a shell script, which will count and print/echo how many changes were made executing an SED command...
Eg: Let's use the SED command, to delete every line if it matches a specific character.
sed '/@gmail.com/d' F1.txt > RESULT.txt
F1.txt file contains:
email@example.com firstname.lastname@example.org email@example.com firstname.lastname@example.org
The output of this file would be:
Therefore it matched two lines and deleted the two lines.
Now how to echo this in a Shell script with an Echo, suggesting how many lines were modified/deleted by this SED command?
It should sound and Print/Echo, 2 lines where deleted. Can you please help how to make this shell script?
#!/bin/bash sed '/@gmail.com/d' F1.txt > RESULT.txt