I have bunch of .cpp files. say tes1.cpp
I need to write a script,
find which file has abc pattern,
if found need to find if it has //commented pattern,
if it is found then find if //additional text,
if not found then add a line of text //additional comment above //commented
output file should be, test1.cpp
i tried with
if grep -Erl '\babc\b' *; then
if grep "//commented" ; then
echo "Already updated"
sed '\/\/ commented /i\// additional comment'
but execution hangs. how do i do it?
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered