This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I need to insert newline character in my file (which is basically single long line caontaining many @ along with other data) I want to insert newline character after every "@" character that I see.
Can I sue sed to achive this? How id newline character specified in it?
Would be a nice solution, except that it doesn't work. Sed doesn't do regular expressions in the replacement part. Newish GNU versions of sed do actually support backslash-newline in the replacement part, like this:
Note how the first line ends in a backslash. The single quotes are important here.
I use GNU sed 4.0.7 and don't have problems with truncated output. And it works perfectly with , which I used for testing, since I don't have a file laying around, containing '@'.
Since sed operates on input, line by line, it might get confused by additional lines. But I don't want to read the detailed specification. [ September 30, 2004: Message edited by: Stefan Wagner ]
Gemini Moses
Ranch Hand
Joined: Jan 04, 2001
Posts: 244
posted
0
Thanks Stefan!
Can you provide me some link where I should be reading the specification to find out details about this problem.
I don't know whether newline-confusion is really the reason, or what else. I would try following: Search for an character, which will not occur normally in input. Assuming '#'. Translate with sed @->@#:
now I would compare sizes.
should be the difference between them. Then I would 'translate'.