Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unable to sort file name in Unix Post 302567416 by kkkk_ssss on Monday 24th of October 2011 07:12:34 AM
Old 10-24-2011
Unable to sort file name in Unix

Hi,

I'm unable to sort the files with the required names on Unix. Details have been enclosed:-

Below are the fle name inside a folder, now i need to sort them in a way that they are group with the seconds occurance in the file name (E.g 01954,07947,06794)

01.01954.MXRS1.rcv
01.06794.MXRS2.rcv
01.07947.MXRS3.rcv
02.01954.MXRS4.rcv
02.06794.MXRS5.rcv
02.07947.MXRS6.rcv

Required result should be :-

01.01954.MXRS1.rcv
02.01954.MXRS4.rcv
01.06794.MXRS2.rcv
02.06794.MXRS5.rcv
01.07947.MXRS3.rcv
02.07947.MXRS6.rcv

Should sort by the above bold chanracters.

How to achieve this ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File size limitation of unix sort command.

hi , iam trying to sort millions of records which is delimited and i cant able to use sort command more than 60 million..if i try to do so i got an message stating that "File size limit exceeded",Is there any file size limit for using sort command.. How can i solve this problem. thanks ... (7 Replies)
Discussion started by: cskumar
7 Replies

2. UNIX for Dummies Questions & Answers

unix SORT

Hey guys. I am trying to sort a file by account number through UNIX. I have a few things but it seems to sort by account number AND sort everything after the account number. Help please. Thanks (5 Replies)
Discussion started by: ndoggy020
5 Replies

3. Shell Programming and Scripting

Unable to use sort command in Shell Script

Hello All, I am creating a shell script that reads a file(test.txt) with the following data, 0.0.0.0 10.10.10.0 10.10.10.1 10.10.10.10 10.10.10.2 10.10.10.3 10.10.10.4 10.10.10.5 10.10.10.6 10.10.10.7 10.10.10.8 10.10.10.9 If I use the sort, the highest value I am getting is... (1 Reply)
Discussion started by: racbern
1 Replies

4. Shell Programming and Scripting

UNix one-liner to sort a file

Hi everyone, I have a txt file as: >001.b1 GCTAGTGCTAGCTAGCTAGCATCGATCGAT >002.b1 CAGTCAGTCGTAGTGCTAGCTGATGCTCGT >003.b1 CGATCGTAGTCGTATCGATGCTGACGTAGG >002.g1 ATGCTGATCGACTAGCTAGTCGT >015.b1 CGATCTAGTAGTGCTAGTCGTTT >001.g1 ATGCTGATCGACTAGCTAGTCGT >003.g1 CGATGCTAGTCGATGCTGACGGG (3 Replies)
Discussion started by: ad23
3 Replies

5. Shell Programming and Scripting

Unable to get the correct sort order in perl.

Hi, I have created the hash. %hash; @arr1 = qw(Dealnum AdminStatus adminReason effFrom effTo); @arr2 = qw(121212121 YES 1992-06-19T05:14:27 ); @hash{@arr1}=@arr2; foreach(sort keys %hash){ print "$_ ---- $hash{$_}\n"; } The output i got like this: C:\strawberry\perl\bin>perl... (1 Reply)
Discussion started by: vanitham
1 Replies

6. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

7. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

8. UNIX for Dummies Questions & Answers

sort a unix file by 3rd column

Hi, Can anybody tell me how to sort a unix file by 3rd column and not by ltr? Please help Thanks in advance (2 Replies)
Discussion started by: vinnyvirk
2 Replies

9. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

10. Shell Programming and Scripting

How to Modify a file content in UNIX and sort for only required fields ?

I have the below contents in a file after making the below curl call curl ... | grep -E "state|Rno" | paste -sd',\n' | grep "Disconnected" > test "state" : "Disconnected",, "Rno" : "5554f1d2" "state" : "Disconnected",, "Rno" : "10587563" "state" : "Disconnected",, "Rno" :... (2 Replies)
Discussion started by: Vaibhav H
2 Replies
IPC::Msg(3perl) 					 Perl Programmers Reference Guide					   IPC::Msg(3perl)

NAME
IPC::Msg - SysV Msg IPC object class SYNOPSIS
use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR); use IPC::Msg; $msg = IPC::Msg->new(IPC_PRIVATE, S_IRUSR | S_IWUSR); $msg->snd($msgtype, $msgdata); $msg->rcv($buf, 256); $ds = $msg->stat; $msg->remove; DESCRIPTION
A class providing an object based interface to SysV IPC message queues. METHODS
new ( KEY , FLAGS ) Creates a new message queue associated with "KEY". A new queue is created if o "KEY" is equal to "IPC_PRIVATE" o "KEY" does not already have a message queue associated with it, and "FLAGS & IPC_CREAT" is true. On creation of a new message queue "FLAGS" is used to set the permissions. Be careful not to set any flags that the Sys V IPC implementation does not allow: in some systems setting execute bits makes the operations fail. id Returns the system message queue identifier. rcv ( BUF, LEN [, TYPE [, FLAGS ]] ) Read a message from the queue. Returns the type of the message read. See msgrcv. The BUF becomes tainted. remove Remove and destroy the message queue from the system. set ( STAT ) set ( NAME => VALUE [, NAME => VALUE ...] ) "set" will set the following values of the "stat" structure associated with the message queue. uid gid mode (oly the permission bits) qbytes "set" accepts either a stat object, as returned by the "stat" method, or a list of name-value pairs. snd ( TYPE, MSG [, FLAGS ] ) Place a message on the queue with the data from "MSG" and with type "TYPE". See msgsnd. stat Returns an object of type "IPC::Msg::stat" which is a sub-class of "Class::Struct". It provides the following fields. For a description of these fields see you system documentation. uid gid cuid cgid mode qnum qbytes lspid lrpid stime rtime ctime SEE ALSO
IPC::SysV, Class::Struct AUTHORS
Graham Barr <gbarr@pobox.com>, Marcus Holland-Moritz <mhx@cpan.org> COPYRIGHT
Version 2.x, Copyright (C) 2007-2010, Marcus Holland-Moritz. Version 1.x, Copyright (c) 1997, Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-19 IPC::Msg(3perl)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy