Ubence Quevedo wrote:
On Sep 22, 2008, at 04:34 PM, Rick Stevens wrote:Ubence Quevedo wrote:----- Original Message ----From: Patrick O'Callaghan <pocallaghan gmail com> To: fedora-list redhat com Sent: Monday, September 22, 2008 3:03:35 PM Subject: Re: Text Manipulation/Replacement On Mon, 2008-09-22 at 14:57 -0700, Ubence Quevedo wrote:combination of grep and awk to single out data and replace formatting that I didn't need.Hello All, I've used pdftotext to convert a pdf document to text and then used aThe output data eventually looks like this: 12,123456789 ,0987654321 But I want it to look like this: 12,123456789,0987654321I've tried many different things with awk, but I can't get it replace \r, withjust a , For one thing, end-of-line in standard Unix text files is not \r (Carriage Return), it's \n (Newline).Thanks for splitting hairs. :^) \r is what first came to mind.I've got a lead from another list that I posted on how to use perl to accomplish what I need, but it isn't specific enough to not replace all new lines with empty space: cat foo.txt | perl -pi -e 's/\n//g'Anyone have any ideas?Uh, how about: cat file.txt | sed '$!N;s/\n//' >newfile.txtHi Rick,I'll have to play with this some more, but this appears to have done the trick!Thank you so much!
You're welcome. There's actually a good page of "sed one-liners" (helpful one-line sed scripts) at: http://sed.sourceforge.net/sed1line.txt Turns out the one I gave you is on that list as "# join pairs of lines side-by-side (like "paste")", but that one strips the last "\n" and tacks on a space, which mine doesn't. ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer ricks nerd com - - AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 - - - - Do you know where _your_ towel is? - ----------------------------------------------------------------------