01-29-2011
Solution.
The language is C++ and the solution is this: I copy pasted directly in to my code and it worked great.
struct myLessThan : public binary_function< string, string, bool > { bool operator()( first_argument_type e1, second_argument_type e2 ) const { // TODO 1: // optionally preprocess e1 and e2 here and strip the "HD" postfix // or consider it for the actual comparison later on // TODO 2: // use an alternative string-to-int conversion istringstream is1(e1), is2(e2); int i1, i2; is1 >> i1; is2 >> i2; return i1 < i2; } }; // use the functor like this: sort(mychans.begin(),mychans.end(),myLessThan());
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I'm trying to write a ksh script to copy a specified number of files from one directory to another.
The files are named in the convention <switchname>_log.<num> and the numbers are sequential single digit onwards. I figured I could find some parameter for ls which would list the files in... (3 Replies)
Discussion started by: Steve_H
3 Replies
2. Shell Programming and Scripting
Hi,
I trying to find the solution for writing the programming in unix by shell programming for sorting thr string in alphabetical order.
I getting diffculty in that ,, so i want to find out the solution for that
Please do needful
Thanks
Bhagyesh (1 Reply)
Discussion started by: bp_vanarse
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have 500 directories each with multiple data files inside them. The names are sort of random. For example, one directory has files named e_1.dat, e_5.dat, e_8.dat, etc. I need to move the files to a single directory and rename them all in numerical order, from 1.dat to 1000(or some... (1 Reply)
Discussion started by: renthead720
1 Replies
4. Shell Programming and Scripting
Hi,
Hope someone can shed some light on this...
I have two lists of numbers I am comparing using COMM. If the first list is empty, and I sort both lists like so:
DIFF=`comm -3 <(echo "$EMPTY" | sort -n) <(echo "$NUMBERS" | sort -n)`I get the error: comm: file 2 is not in sorted order
But... (2 Replies)
Discussion started by: LostInTheWoods
2 Replies
5. UNIX for Dummies Questions & Answers
Hi
I am newbie to unix scripting, but i have enough knowledge to understand.
I have a specific questions like, I use to collect like 3500 files per experiment, each one named like
data_001.img..
data_002.img
data_003.img
....
data_3500.img
I would like to move every 12 files in the 3500... (3 Replies)
Discussion started by: wpat
3 Replies
6. Programming
I've been struggling with this for quite some time. I decided I should get some help with this. Nothing is working. I'm getting a segmentation fault or out of bounds error when I try to load the entries in the for loop.I'm really frustrated. :mad: Compiling isn't the problem. It's crapping out on... (5 Replies)
Discussion started by: sepoto
5 Replies
7. Programming
In some cases I would like to sort by index, in some cases by color and in some cases by Callsign. Can this be done? :D
vector< vector<string> > table;
vector<string> row;
row.push_back("1");row.push_back("green");row.push_back("alpha");
table.push_back(row);... (0 Replies)
Discussion started by: sepoto
0 Replies
8. UNIX for Dummies Questions & Answers
I have a column of numbers in the following format:
1.722e-05
2.018e-05
2.548e-05
2.747e-05
7.897e-05
4.016e-05
4.613e-05
4.613e-05
5.151e-05
5.151e-05
5.151e-05
6.1e-05
6.254e-05
7.04e-05
7.12e-05
7.12e-05 (6 Replies)
Discussion started by: evelibertine
6 Replies
9. Shell Programming and Scripting
Hi experts,
I have a list of files containing forces as the only number as follows.
Force1.txt Force2.txt Force3.txt Force4.txt Force5.txt . . . . . . . . . Force100.txt I want to put all the data(only a number ) in these forces files in the file with the same order like 1,2,3 ..100 .... (2 Replies)
Discussion started by: hamnsan
2 Replies
10. Shell Programming and Scripting
Hello,
I have a large database of words and would like them sorted in reverse order i.e. from the end up.
An example will make this clear:
I have tried to write a program in Perl which basically takes the string from the end and tries to sort from that end but it does not seem... (5 Replies)
Discussion started by: gimley
5 Replies
LEARN ABOUT DEBIAN
iset_destroy
ISET(3pub) C Programmer's Manual ISET(3pub)
NAME
iset_create, iset_destroy, iset_copy, iset_is_empty, iset_add, iset_add_range, iset_remove, iset_remove_range, iset_clear, iset_contains,
iset_union, iset_diff, iset_isect, iset_range, iset_nth_range - manipulate sets of integers
SYNOPSIS
#include <publib.h>
Iset *iset_create(void);
void iset_destroy(Iset *is);
Iset *iset_copy(const Iset *is);
int iset_is_empty(const Iset *is);
int iset_add(Iset *is, long number);
int iset_add_range(Iset *is, long number1, long number2);
int iset_remove(Iset *is, long number);
int iset_remove_range(Iset *is, long number1, long number2);
void iset_clear(Iset *is);
int iset_contains(const Iset *is, long number);
int iset_union(Iset *is1, const Iset *is2);
int iset_diff(Iset *is1, const Iset *is2);
int iset_isect(Iset *is1, const Iset *is2);
void iset_range(const Iset *is, long *lowest, long *highest);
int iset_nth_range(const Iset *is, long n, long *lo, long *hi);
DESCRIPTION
These functions operate on sets of integers (of type long). You clever people will know how to use them without my help, which saves me
from writing a manual page.
SEE ALSO
publib(3), bitarr(3)
AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual ISET(3pub)