06-07-2011
Quote:
Originally Posted by
pankaj80
Hi Skrynesaver
I copied the code suggested by you but it actually sorting all the file and not asking user to enter specific file or file pattern and than sorting only those files. Can you pls amend the script so it sort only the selective files and not all placed in that location. Your help is much appreaciated.
As stated above. it takes a pattern as an argument and uses shell expansion to provide a list of filenames as the argument to the sort command in the for loop.
ie
sorter.sh '*.txt'
or
sorter.sh \*.data
would use the pattern povided
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all
i am very new to shell scripting,hope u guys can help
i need to replace,sort and append character for the file that look like this:
1007032811010001000100000001X700026930409
1007032811010001000200000002X700026930409
1007032711020001000300000003X700026930409... (2 Replies)
Discussion started by: ashikin_8119
2 Replies
2. Shell Programming and Scripting
Hi
having a file as follows
MediaErr.log
84 Server1 Policy1 Schedule1 master1 05/08/2008 02:12:16
84 Server1 Policy1 Schedule1 master1 05/08/2008 02:22:47
84 Server1 Policy1 Schedule1 master1 05/08/2008 03:41:26
84 Server1 Policy1 ... (1 Reply)
Discussion started by: karthikn7974
1 Replies
3. Shell Programming and Scripting
Hi
I have a requirement like below
I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory
My files looks like this
PGABOLTXML1D_201108121235.xml... (1 Reply)
Discussion started by: saidutta123
1 Replies
4. Shell Programming and Scripting
I would like to know how to sort version numbers, using bash or perl. I would like to sort file names that are program names with version numbers and extensions, such as hello-0.2.3.tar.gz and hello-0.10.3.tar.gz.
Version numbers of computer programs do not comply with the mathematical rule... (3 Replies)
Discussion started by: LessNux
3 Replies
5. Shell Programming and Scripting
Hi. I am not sure the title gives an optimal description of what I want to do. Also, I tried to post this in the "UNIX for Dummies Questions & Answers", but it seems no-one was able to help out.
I have several text files that contain data in many columns. All the files are organized the same... (14 Replies)
Discussion started by: JamesT
14 Replies
6. Shell Programming and Scripting
Hello,
I am looking to automate a task - which is updating an existing access control instruction of a server and making sure that the attributes defined in the instruction is in sorted order. The instructions will be of a specific syntax.
For example lets assume below listed is one of an... (6 Replies)
Discussion started by: sanjayroc
6 Replies
7. Shell Programming and Scripting
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
8. Shell Programming and Scripting
To make it easier, i gave following example. It is not homework or classwork. Instead, i have a huge csv file dump from tsql with 15 columns and around 300 rows. I was able to extract content that needs to be really converted. Here is the extract:
ES FP,B1ES FP,70000,I,SL22,SL22 (70000)
ES... (0 Replies)
Discussion started by: nike27
0 Replies
9. Shell Programming and Scripting
To make it easier, i gave following example. It is not homework or classwork. Instead, i have a huge csv file dump from tsql with 15 columns and around 300 rows. I was able to extract content that needs to be really converted. Here is the extract:
ES FP,B1ES FP,70000,I,SL22,SL22 (70000)
ES... (8 Replies)
Discussion started by: nike27
8 Replies
10. UNIX for Dummies Questions & Answers
I've got a disorganized list of items and quantities for each. I've been using a combination of grep and sort to find out how much to buy of each item. I'm tired of having to constantly using these commands so I've been trying to write a shell script to make it easier, but I can't figure out how... (3 Replies)
Discussion started by: PTcharger
3 Replies
LEARN ABOUT DEBIAN
smokeping_sorters_base
..::lib::Smokeping::sorters::base(3) SmokePing ..::lib::Smokeping::sorters::base(3)
NAME
Smokeping::sorters::base - Base Class for implementing SmokePing Sorters
OVERVIEW
Sorters are at the core of the SmokePing Charts feature, where the most interesting graphs are presented on a single page. The Sorter
decides which graphs are considerd interesting.
Every sorter must inherit from the base class and provide it's own methods for the 'business' logic.
In order to maintain a decent performance the sorters activity is split into two parts.
The first part is active while the smokeping daemon gathers its data. Whenever data is received, the sorter is called to calculate a
'value' for the present data. On every 'query round' this information is stored in the sorter store directory. Each smokeping process
stores it's own information. Since smokeping can run in multiple instances at the same time, the data may be split over several files
The second part of the sorter is called from smokeping.cgi. It loads all the information from the sorter store and integrates it into a
single 'tree'. It then calls each sorter with the pre-calculated data to get it sorted and to and to select the interesting information.
DESCRIPTION
Every sorter must provide the following methods:
new
The new method expects hash elements as an argument eg new({x=>'d+',y=>'d+'},x=>1,y=>2). The first part is a syntax rule for the
arguments it should expect and the second part are the arguments itself. The first part will be supplied by the child class as it calls the
parent method.
Desc
Simply return the description of the function. This method must be overwritten by a children of the base class.
SortTree
Returns an array of 'targets'. It is up to the sorter to decide how many entries the list should contain. If the list is empty, the whole
entry will be supressed in the webfrontend.
The methode gets access to all the targets in the system, together with the last data set acquired for each target.
CalcValues
Figure out the curent sorting value using te following input.
$info = { uptime => w,
loss => x,
median => y,
alert => z, # (0/1)
pings => [qw(a b c d)] }
The output can have any structure you want. It will be returned to the sorter method for further processng.
COPYRIGHT
Copyright (c) 2007 by OETIKER+PARTNER AG. All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
AUTHOR
Tobias Oetiker <tobi@oetiker.ch>
2.6.8 2012-02-26 ..::lib::Smokeping::sorters::base(3)