Re: Awk and sort (of text files)

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

 





On 06/28/2015 07:02 PM, Stephen Davies wrote:

On 29/06/15 10:13, jd1008 wrote:


On 06/28/2015 06:38 PM, jd1008 wrote:
Hi,
I have text files made of paragraphs of text, separated by
blank lines.

Each "paragraph" is information about a different item.

In need to sort these paragraphs based on the first line
of each paragraph.

Need some hints how to accomplish this.

Thanx.
Forgot to say that each paragraph is made of multiple lines,
but a paragraph's lines do not contain a blank line.
I would just concatenate lines until the blank is reached then write out the concatenated line.
The result can then be sorted.

If you want to revert the result to paragraphs, just reverse the process outputting lines of up to N characters ending in a space.

HTH,
Stephen

Too much work to break the one line back into multiple lines because the lines are of different lengths. Too many files also. Also, to keep original lines of a paragraph unmangled, I would have to first do something like append each line of a paragraph with a delineating character to be used by something
like sed to change that character into a newline.
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux