Sponsored Content
Full Discussion: Sorting files
Top Forums Shell Programming and Scripting Sorting files Post 302571483 by kristinu on Monday 7th of November 2011 01:21:36 PM
Old 11-07-2011
Sorting files

I have the following set of files and I want to order them according to the ascending values of the run:

For example, doing

Code:
ls -lrt *drw*.log

gives

Code:
    n02-z30-sr65-rgdt0p25-dc0p08-4x3drw.log
    n02-z30-sr65-rgdt0p25-dc0p03-8x6drw.log
    n02-z30-sr65-rgdt0p25-dc0p01-8x6drw.log
    n02-z30-sr65-rgdt0p25-dc0p05-8x6drw.log
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run3.log
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run3.log
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run3.log
    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run3.log
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run3.log

But I want to have a listing like

Code:
    n02-z30-sr65-rgdt0p25-dc0p08-4x3drw.log
 
    n02-z30-sr65-rgdt0p25-dc0p01-8x6drw.log
 
    n02-z30-sr65-rgdt0p25-dc0p03-8x6drw.log

    n02-z30-sr65-rgdt0p25-dc0p05-8x6drw.log

    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p004-16x12drw-run3.log
  
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p006-16x12drw-run3.log
 
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p01-16x12drw-run3.log
 
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p008-16x12drw-run3.log
 
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run1.log
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run2.log
    n02-z30-sr65-rgdt0p25-dc0p002-16x12drw-run3.log

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sorting files

ok so I'm having major issues trying to figure this out: I have this program that I'm inputting the files in hte current directory which are image files...it spits out 5 line chunks describing the files... filename: (name of file) size: (100 x 200) arbitrary data arbitrary data arbitrary... (4 Replies)
Discussion started by: Infraredskies
4 Replies

2. Shell Programming and Scripting

Sorting files

Hi, What is the command for sorting files according to their size Thanx in advance (4 Replies)
Discussion started by: sendhil
4 Replies

3. Shell Programming and Scripting

Sorting Files

How to sort such files which contains records of varying length and varying lines? (With respect to Bash shell) Eg: Each record begins with a sting of 1/0(binary) which may or may not be followed by properties like AB,BS etc. I have to sort such records on the basis of 1/0 string and keep the... (2 Replies)
Discussion started by: sandeep_hi
2 Replies

4. Shell Programming and Scripting

need help listing/sorting files

I am currently attempting to create a file which I access from an oracle form. At the minute I do a host command and run an ls -l e.g. /bin/ls -l /dir/dir/dir/ > /tmp/list.txt I then read this file within my oracle form. However I want the user to be able to restrict, sort and filter the... (2 Replies)
Discussion started by: dave_angel
2 Replies

5. UNIX for Dummies Questions & Answers

Need some help for sorting files

I am new to shell scripting can u guys please provide a small script for the following senario step1:need to find some files in a directory for ex having 020908 step2:sort them and redirecting to new file (ex:sort abc > abc.sort) i am trying this but giveing flag error ls -l... (4 Replies)
Discussion started by: cgreddy2020
4 Replies

6. Shell Programming and Scripting

sorting files

hi i have file like below: col1,col2,col3,col4 val1,val2,val3,val4 abc1,abc2,abc3,abc4 this is a 4 column file with 3 rows. i want to sort the file like.. first on col1, then on col2 and so ..on.. i want the sort order to be descending. Pls help.. Thnks Sumit (2 Replies)
Discussion started by: sumit207
2 Replies

7. UNIX for Dummies Questions & Answers

Sorting files in different directories

hi everybody, first time writing. Here's my question: I've got several files in different directories like this: aa/t1 aa/bb/t2 aa/t2 aa/bb/cc/t1 aa/t3 and would like to get this sorting: aa/t1 aa/bb/cc/t1 aa/t2 aa/bb/t2 aa/t3 (1 Reply)
Discussion started by: Camisa
1 Replies

8. UNIX for Dummies Questions & Answers

help with sorting files

find / -type f 2> /dev/null | find -inum +1 2> /dev/null | find -mtime -30 2> /dev/null what i am trying to do i search all regular files in root directory with one or more inodes modified within last 30 days. the /dev/null is to suppress the permission denied outputs. i am now trying to... (5 Replies)
Discussion started by: iluvsushi
5 Replies

9. Shell Programming and Scripting

i need help in sorting two files

i have file a 123 234 456 567 678 and file b 123|xxx|hhh|ppp or zzz 234|rrr|ttt|xxx 432|ttt|mmm|nnn 678|cft|byt|mop i want to compare file a to file b such that when each of the lines in file a can be found in file b column1 and also xxx or hhh or ppp or zzz can be... (12 Replies)
Discussion started by: blackzinga80
12 Replies

10. Shell Programming and Scripting

Complex data sorting in excel files or text files

Dear all, I have a complex data file shown below,,,,, A_ABCD_13208 0 0 4.16735 141044 902449 1293900 168919 C_ABCD_13208 0 0 4.16735 141044 902449 1293900 168919 A_ABCDEF715 52410.9 18598.2 10611 10754.7 122535 252426 36631.4 C_DBCDI_1353 0... (19 Replies)
Discussion started by: AAWT
19 Replies
PAM_FILTER(8)							 Linux-PAM Manual						     PAM_FILTER(8)

NAME
pam_filter - PAM filter module SYNOPSIS
pam_filter.so [debug] [new_term] [non_term] run1|run2 filter [...] DESCRIPTION
This module is intended to be a platform for providing access to all of the input/output that passes between the user and the application. It is only suitable for tty-based and (stdin/stdout) applications. To function this module requires filters to be installed on the system. The single filter provided with the module simply transposes upper and lower case letters in the input and output streams. (This can be very annoying and is not kind to termcap based editors). Each component of the module has the potential to invoke the desired filter. The filter is always execv(2) with the privilege of the calling application and not that of the user. For this reason it cannot usually be killed by the user without closing their session. OPTIONS
debug Print debug information. new_term The default action of the filter is to set the PAM_TTY item to indicate the terminal that the user is using to connect to the application. This argument indicates that the filter should set PAM_TTY to the filtered pseudo-terminal. non_term don't try to set the PAM_TTY item. runX In order that the module can invoke a filter it should know when to invoke it. This argument is required to tell the filter when to do this. Permitted values for X are 1 and 2. These indicate the precise time that the filter is to be run. To understand this concept it will be useful to have read the pam(3) manual page. Basically, for each management group there are up to two ways of calling the module's functions. In the case of the authentication and session components there are actually two separate functions. For the case of authentication, these functions are pam_authenticate(3) and pam_setcred(3), here run1 means run the filter from the pam_authenticate function and run2 means run the filter from pam_setcred. In the case of the session modules, run1 implies that the filter is invoked at the pam_open_session(3) stage, and run2 for pam_close_session(3). For the case of the account component. Either run1 or run2 may be used. For the case of the password component, run1 is used to indicate that the filter is run on the first occasion of pam_chauthtok(3) (the PAM_PRELIM_CHECK phase) and run2 is used to indicate that the filter is run on the second occasion (the PAM_UPDATE_AUTHTOK phase). filter The full pathname of the filter to be run and any command line arguments that the filter might expect. MODULE TYPES PROVIDED
All module types (auth, account, password and session) are provided. RETURN VALUES
PAM_SUCCESS The new filter was set successfully. PAM_ABORT Critical error, immediate abort. EXAMPLES
Add the following line to /etc/pam.d/login to see how to configure login to transpose upper and lower case letters once the user has logged in: session required pam_filter.so run1 /lib/security/pam_filter/upperLOWER SEE ALSO
pam.conf(5), pam.d(5), pam(8) AUTHOR
pam_filter was written by Andrew G. Morgan <morgan@kernel.org>. Linux-PAM Manual 09/19/2013 PAM_FILTER(8)
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy