Text Manipulation/Replacement

Chris Mohler cr33dog at gmail.com
Mon Sep 22 22:22:43 UTC 2008


On Mon, Sep 22, 2008 at 4:57 PM, Ubence Quevedo <r0d3nt at pacbell.net> wrote:
> Hello All,
>
> I've used pdftotext to convert a pdf document to text and then used a
> combination of grep and awk to single out data and replace formatting
> that I didn't need.
>
> The output data eventually looks like this:
> 12,123456789
> ,0987654321
>
> But I want it to look like this:
> 12,123456789,0987654321
>
> I've tried many different things with awk, but I can't get it replace \r, with just a ,

Hmm - I've always had headaches dealing with newlines in sed and awk
(to a lesser extent - I'm more familiar with sed).

How about perl?

cat foo.txt | perl -pi -e 's/\n//g'

Chris




More information about the ubuntu-users mailing list