I have a set of records in plaintext where each record begins with "# file" and that line doesn't appear anywhere but the start of the record. Records should be separated by a blank line (\n\n) but some records are missing the space.
I thought the following perl one-liner would work but it doesn't. What am I doing wrong???
cat <record file> | perl -p -e "s/(?=\w)\n# file/\n\n# file/sg"
My problem is that somehow I can't seem to search across the newline which is what I thought the /s was supposed to help with