You can do this with awk. Print out each input line, but to a file name that changes whenever the input line indicates that a new file starts.
awk '
/^\/\/abc\// { filename = $1; sub(/.*\//, "", filename); next; }
filename { print >filename }
'
Remove the call to next
if you want the header lines to be included, e.g. to have //abc/file1.js
as the first line of file1.js
. You may want to tweak the code that recognizes header lines depending on your requirements. Text prior to the first header line will not be printed anywhere; change filename { … }
to 1 { … }
if you want to print it to standard output.