Sponsored Content
Full Discussion: numerically sorted filenames
Top Forums UNIX for Dummies Questions & Answers numerically sorted filenames Post 302514012 by vgersh99 on Thursday 14th of April 2011 01:50:33 PM
Old 04-14-2011
Code:
ls | nawk -F_ '{print $NF,$0}' | sort -k 1,1n | cut -d ' ' -f2-

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sort file alphabetically AND numerically

Hi all. I have 2 files like this: f1 A 10 B 80 C 9 f2 A 11 B 700 C 10 What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this: F3 (cat f1 f2 sorted) A 10 A 11 B 80 B 700 (2 Replies)
Discussion started by: mrodrig
2 Replies

2. Shell Programming and Scripting

Numerically sort problem for a long list of file name

I got a long list of file name. My input: data_1.txt data_2.txt data_3.txt data_10.txt data_21.txt data_12.txt data_4.txt My desired output: data_1.txt data_2.txt data_3.txt data_4.txt data_10.txt data_12.txt data_21.txt Does anybody got idea how to archive it? (11 Replies)
Discussion started by: patrick87
11 Replies

3. UNIX for Dummies Questions & Answers

Sort 2 columns numerically

Hi, A basic query. In the example file below, I want to sort by column 1 and then by column 2 numerically. I have tried sort -k2n,1 file1 but while this sorts the columns in the correct order, it does not sort column 2 numerically. Any help would be much appreciated. Also, if you have time to... (3 Replies)
Discussion started by: auburn
3 Replies

4. Shell Programming and Scripting

Sort numerically a non numerical

Hello, I have this sample data: 01 * * * * 01 * * * * 01 * * * * 01 * * * * 01 0 * * * 01 0 * * * 01 0 * * * 01 0 * * * 02 * * * 0 02 * * * 0 02 * * * 6 02 * * * 6 02 0 * * 1 02 0 * * 1 02 0 * * 2 02 0 * * 2 02 0 * * 3 (3 Replies)
Discussion started by: gio001
3 Replies

5. Shell Programming and Scripting

Sort alphabetically, then numerically

Greetings - I'm not necessarily new to bash scripting - I'm probably between beginner and intermediate, but I have something that I just cannot figure out after many attempts to find it. I have a file that is merely a list of many files, with their respective paths, and a branch path (ClearCase)... (5 Replies)
Discussion started by: 1cor29
5 Replies

6. Programming

can this b numerically SOLVED in FORTRAN?

hello people...i have beeen given this projectile problem to be solved numerically in FORTRAN..i have coded it using runge0kutta 4th order ......now the thing is that i have not been given the end points of time,,;ie. the range.. and i am asked to a)the maximum height attained by the... (2 Replies)
Discussion started by: lapachacha
2 Replies

7. Shell Programming and Scripting

Read filenames in sorted order

Hi , My requirement is to scan a directory for file names with LTR.PDF* and send those files via ftp to another server one by one. Now the the problem is file names are like LTR.PDF ,LTR.PDF1 ,LTR.PDF2.....LTR.PDF10..upto 99 and these needs to be sent in sorted order. is there a way to get... (10 Replies)
Discussion started by: nishantrk
10 Replies

8. UNIX for Dummies Questions & Answers

Sorting numerically considering both negative and positve numbers

Dear Experts, I have an IP file which looks like below ---- 100 200 5.02 100 200 -2.99 100 200 -3.01 200 300 2.05 200 300 3.01 200 300 -5.06 I want an OP which looks like (decreasing numerically)-- 100 200 5.02 100 200 -2.99 100 200 -3.01 200 300 3.01 200 300 2.05 200 300 -5.06 (2 Replies)
Discussion started by: Indra2011
2 Replies

9. Shell Programming and Scripting

List numerically in ascending order

Hello, I am running ubuntu 16.04 and trying to list all files inside a directory, I need to sort them in ascending order. While surfing on the site, I found an old thread but somehow it did not work. Link Ascending order with sort -nk2 myfile.txt command gives below output: file... (5 Replies)
Discussion started by: baris35
5 Replies

10. UNIX for Beginners Questions & Answers

How to sort files in directory numerically?

Trying to sort a bunch of files numerically but can't seem to get the command just right. This is in a IBM AIX machine. I have a directory that has... backup.bk1 backup.bk100 backup.bk2 backup.bk200 backup.bk3 backup.bk300 There are a lot more files but this is shortened for the... (5 Replies)
Discussion started by: c3rb3rus
5 Replies
PAF(1p) 						User Contributed Perl Documentation						   PAF(1p)

NAME
paf - Pod Abstract Filter. Transform Pod documents from the command line. SYNOPSIS
sh$> paf summary /usr/bin/paf paf add_podcmds SomeModule.pm paf sort -heading=METHODS Pod/Abstract/Node.pm # METHODS is default paf sort summary Pod/Abstract/Node.pm # See Pod::Abstract::Filter::overlay paf overlay sort cut clear_podcmds SomeClass.pm # -p will emit pod source, instead of spawning perldoc. paf -p sort Pod::Abstract::Node paf -p find hoist Pod::Abstract::Node DESCRIPTION
Paf is a small but powerful, modular Pod filter and transformation tool. It allows full round-trip transformation of Pod documents using the Pod::Abstract library, with multiple filter chains without having to serialise/re-parse the document at each step. Paf comes with a small set of useful filters, but can be extended by simply writing new classes in the "Pod::Abstract::Filter" namespace. FILTERS
add_podcmds Add explicit =pod commands at the end of each cut section, so that all pod sections are started with an =pod command. clear_podcmds Remove all =pod commands that are not ending cut blocks. This will clean up documents that have been reduced using the "cut" filter too. cut Remove all cut nodes, so that only the pod remains. overlay paf overlay Source.pm For overlay to work, there must be a "begin :overlay/end :overlay" section in the Source file, with "=overlay SECTION Module" definitions inside. The net effect is that any missing subheadings in SECTION are added from the same section in the specified Modules. Note that this will overlay the whole subheading, INCLUDING CUT NODES, so it can add code to the source document. Use "cut" if you don't want this. Each overlaid section will include a "=for overlay from" marker, so that it can be replaced by a subsequent overlay from the same file/module. These sections will be replaced in-place, so ordering of sections once first overlaid will be preserved. unoverlay paf unoverlay Source.pm Strips all sections marked as overlaid and matching the overlay spec from the source. sort paf sort [-heading=METHODS] Source.pm Sort all of the subheadings in the named heading (METHODS if not provided). This will move cut nodes around with their headings, so your code will mutate. Use "cut" if you only want pod in the output. Alternatively, you can also cause sorting of headings to occur by including "=for sorting" at the start of your section (before the first subheading). summary Provide an abbreviated summary of the document. If there is a verbatim node in the body of a heading containing the heading name, it will be considered an example and expanded as part of the summary. find paf find [-f=]name Source.pm Find specific sub-sections or list items mentioning name. Used to restrict a larger document down to a smaller set that you're interested in. If no -f is specified, then the word following find will be the search term. uncut paf uncut Source.pm Convert cut nodes in the source into verbatim text. Not the inverse of cut! number_sections paf number_sections Source.pm Applies simple multipart (3.1.2) section numbering to head1 through head4 headings. Note that number_sections will currently stuff up some of the cleverness in things like summary, as the section names won't match function names any more. perl v5.10.1 2010-01-03 PAF(1p)
All times are GMT -4. The time now is 02:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy