For producing a NB file without the line breaks you can Get it as a Notebook expression, then Export it with PageWidth -> Infinity as "Package" (other possible options does not work correctly: Export ignores PageWidth -> Infinity when exporting as "NB" and corrupts the code when exporting as "Text"):
Export["document.nb", Get["ExampleData/document.nb"], "Package",
PageWidth -> Infinity, "Comments" -> None]
This method is safe. Mathematica directly opens the generated file as a valid Notebook identical to the original Notebook. The only significant difference is that non-printable ASCII characters (excepting \b\t\n\r\f) are written "as is" when exporting as "Package", but in FullForm when exporting as "NB" (this difference doesn't affect the actual contents of the file when the latter is opened by the FrontEnd).
If you really need the "one Cell - one line" formatting you can simply add a line break before each Cell[ in the obtained string:
Export["document.nb",
StringReplace[
ExportString[Get["ExampleData/document.nb"], "Package", PageWidth -> Infinity,
"Comments" -> None], c : "Cell[" :> "\n" <> c], "Text"]
A special note: this will affect all Cells including the Inline Cells (what may be undesirable but is safe). But the above code isn't safe in the sense that if your file contains textual strings with verbatim Cell[, they will also be modified. You can avoid this corruption by replacing the Head Cell in the Notebook expression with your own uniquely named Head before exporting:
Export["document.nb",
StringReplace[
ExportString[Get["ExampleData/document.nb"] /. Cell -> $$$MyUniqueCellHead$$$,
"Package", PageWidth -> Infinity, "Comments" -> None],
"$$$MyUniqueCellHead$$$" -> "\nCell"], "Text"]
You can ensure that your Head is really unique by appending a random number to it:
With[{uniqName = "$$$MyUniqueCellHead$$$" <> ToString[RandomInteger[{10^8, 10^10}]]},
Export["document.nb",
StringReplace[
ExportString[Get["ExampleData/document.nb"] /. Cell -> Symbol[uniqName], "Package",
PageWidth -> Infinity, "Comments" -> None], uniqName -> "\nCell"], "Text"]]
This method is based on the well-documented and widely used functionality and hence should work reliably.
Here is how the obtained file looks in Notepad with word wrapping turned off:

04/19/2022 IMPORTANT UPDATE
In the recent versions of Mathematica (I tested 12.3.1 and 13.0.1) the Export[..., "Package"]/Put compatibility is partially broken for the "NB" format. The problem is that Export as "Package" and Put write Pattern[sym,obj] as sym:obj instead of Pattern[sym,obj] as it was in earlier versions. The syntax sym:obj is recognized by the FrontEnd as a syntax error when it opens a file as Notebook. I consider this as a bug. As a workaround, we can "protect" the Pattern head like we do above for Cell:
With[{uniqCellHeadName =
"$$$MyUniqueCellHead$$$" <> ToString[RandomInteger[{10^8, 10^10}]],
uniqPatternHeadName =
"$$$MyUniquePatternHead$$$" <> ToString[RandomInteger[{10^8, 10^10}]]},
Export["document.nb",
StringReplace[
ExportString[
Get["ExampleData/document.nb"] /. {Cell -> Symbol[uniqCellHeadName],
Pattern -> Symbol[uniqPatternHeadName]}, "Package", PageWidth -> Infinity,
"Comments" -> None], {uniqCellHeadName -> "\nCell",
uniqPatternHeadName -> "Pattern"}], "Text"]]
"\\\n" -> ""and then perform the search. Do you think that it's trustworthy ? A direct search by means of regular expressions looks much more frightening ... – mitochondrial May 09 '16 at 08:58PageWidth->Infinity. Even if you would be able to do this, your old Notebooks still won't be searchable without re-saving them with the new option. So the correct approach to your problem is to solve it on the level of your string search tool without changing the default behavior of the FrontEnd. – Alexey Popkov May 09 '16 at 11:37Import["ExampleData/document.nb", {"Cells", All}]if you wish to follow the Mathematica route for searching. It returns the list of theCells not in the order in which they are present in the file (what is incorrect from my point of view), but at least it gives them as WL expressions which are convenient for searching. – Alexey Popkov May 09 '16 at 12:09Import[fileIn,"Text"]looks good indeed, but when it comes to regular expressions I still don't go much further than basics. Please, can you point to a source for a reg exp or an algorithm to detect matching square brackets delimitng a Cell ? The commandImport["ExampleData/document.nb", {"Cells", All}]gives me an errorImport::noelem: "The Import element \"\!\(\"Cell\"\)\" is not present when importing as "NB; may be it's because I'm using M. 8.0.1 ? – mitochondrial May 09 '16 at 12:24Import["ExampleData/document.nb", {"Cells", All}]doesn't work and you should instead useImport["ExampleData/document.nb", "Notebook"]what may be even more convenient (depending on your actual goals). – Alexey Popkov May 09 '16 at 19:49