Re: Text Manipulation/Replacement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sep 22, 2008, at 04:34 PM, Rick Stevens wrote:

Ubence Quevedo wrote:
----- Original Message ----
From: Patrick O'Callaghan <pocallaghan@xxxxxxxxx>
To: fedora-list@xxxxxxxxxx
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:
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 ,

For one thing, end-of-line in standard Unix text files is not \r
(Carriage Return), it's \n (Newline).

poc

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
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.txt
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks@xxxxxxxx -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-           Fear is finding a ".vbs" script in your Inbox            -
----------------------------------------------------------------------

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Hi Rick,

I'll have to play with this some more, but this appears to have done the trick!

Thank you so much!

-Ubence

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux