My friends! I'm beginner in bash and faced such a problem. I need to find all comments in cpp file (include multiline) and write them in output file. I don't know how to select comments.
#!/bin/bash
name1=$1 #solution.cpp
name2=$2 #out.txt
if [ ${name1: -4} == ".cpp" ]; then
cat solution.cpp | grep ^\//
else
echo "bad"
fi