my inner geek

When developing stuff, configuring systems, or simply working with computers, I come across obstacles that can be solved easily once you know the solution. But finding the solution can take ages. In this blog, I am collecting the solutions for some of the technical problems that I encounter.

Monday, October 25, 2010

Sort a text file alphabetically

Run

perl -e ' while(<>) { push @lines, $_; } warn "\nSorted $. lines in ascending alphabetical order, ignoring case\n\n"; print sort { lc($a) cmp lc($b) } @lines ' unsorted > sorted_nc_asc


(thanks!)
Posted by michael at 1:18 AM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

My photo
Michael
View my complete profile

Blog Archive

  • ►  2025 (1)
    • ►  March (1)
  • ►  2023 (1)
    • ►  December (1)
  • ►  2022 (4)
    • ►  December (1)
    • ►  June (2)
    • ►  January (1)
  • ►  2021 (1)
    • ►  November (1)
  • ►  2018 (2)
    • ►  November (1)
    • ►  September (1)
  • ►  2016 (5)
    • ►  August (1)
    • ►  June (2)
    • ►  May (1)
    • ►  March (1)
  • ►  2015 (4)
    • ►  December (1)
    • ►  August (1)
    • ►  June (1)
    • ►  April (1)
  • ►  2014 (2)
    • ►  September (1)
    • ►  August (1)
  • ►  2013 (3)
    • ►  October (1)
    • ►  July (1)
    • ►  April (1)
  • ►  2011 (2)
    • ►  March (1)
    • ►  January (1)
  • ▼  2010 (6)
    • ►  December (1)
    • ►  November (1)
    • ▼  October (2)
      • Regular expressions in Notepad++
      • Sort a text file alphabetically
    • ►  June (1)
    • ►  March (1)
Picture Window theme. Powered by Blogger.