I need to unzip a file and for each of the documents in that file, I need to make a correction to the comment (the files are written in C). I'm a bit confused as to how I can do this for each document in the file (I don't know the amount of documents, or their names), is there someway I can write a for loop across the folder to open each document individually and then edit them, within the shellscript?
I'm also a bit confused at the difference between sed and awk and which one I should be using here. I need to edit the comment (which begins with //) and believe I should be using awk but am not too sure.
My pseudocode for this (so far) would be as such
unzip $1
edit_comment(){
cat file1 file2 ... filen > total.txt
*some awk command that will search for all instances of // and replace the text on that line (after
the //) with a new comment*
}
Thanks!