sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list
Thanks
sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list
Thanks
Yes.
help with sorting sequence in Unix C:sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list
--------------------------------------------------------------------------------
Hi List is
000|2008-07-17|556543|RTJ|35-RTGJ|EYT
465|2008-11-10|567789|GHJ|45-DGHH|ETU
533|2008-09-06|567789|GHJ|45-DGHH|ETU
How does it do it?
sort -t ':' +0 -1 -n +1 -2 +2 -3 -o list list
So if you want to know what the options to sort are, read the man page on sort. If you want to know the internals of sort, you can probably find GNU source or BSD source somewhere. If you want to know what any of this has to do with C, well, so do I.
Edit: And a bonus hint: that ':' you have is probably a bad copy of somebody's hand-written IBM-style broken pipe character for '|'. (My keyboard, at least, shows a broken pipe on the key itself, so that's probably what you're looking at.)
Edit edit: Or do you mean the c shell?
Last edited by tabstop; 08-25-2008 at 09:37 PM.
This is a GREAT example of how NOT to ask a question. Sheesh!
Please stop showing off ur whacky IQ.Obviously i checked the man pages on sort.If u guys cant be helpful,keep your mouth shut and be humble instead of pinpointing others' small mistakes.U ll do better than this.U egoistic punks.This forum is supposed to help people learn and not point out stupid mistakes.Fools
I point out my own stupid mistakes all the time... ON THESE FORUMS!
I'll tell you what, if you can settle down there, realize that your first post didn't make sense whatsoever, and write two or three legible sentences followed by a meaningful question, I will try to help you.
But I can't help you if I have no idea what you're going on about.
gurvinder, you may have checked the relevant documentation, but your posts show nothing of the sort. Present your question clearly, state what you are having problem with and what you have tried to solve/understand the problem so that people can see that you have put in effort.
Your response warrants an official warning according to the forum guidelines, but I shall hold it off since you are new and perhaps did not understand the responses you got.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
So apparently your question is about the options after all. (Note that in two whole posts you managed to NOT MENTION WHAT YOUR BLEEDING QUESTION WAS IN ANY WAY WHATSOEVER. Note that this is not a "small mistake" but the largest mistake you can actually make on a help forum. And it turns out that prodding you with questions was in fact helpful, since it made you actually TELL US WHAT YOUR QUESTION IS. Thank you for your consideration of this matter.)
But if you had read the man page, you would have seen this:
Obviously I didn't copy the options you didn't use. (I really shouldn't have bothered doing this, but I'm a giver.)Originally Posted by sort man page
Edit: And obviously the shouting isn't really called for, since you all seem to have had the good conversation while I was cutting and pasting. I apologize.
Last edited by tabstop; 08-25-2008 at 10:20 PM.
That was no metaphor -- that was deadly serious. (I've always heard it called IBM-style even though there's no mention of it at the link -- just EBCDIC, which I guess is close enough.)
Thanks TABSTOP.Can someone or u please clarify the following
In this case
--------------------------------------------------------------------------------
Question Repeat:
Hi List is
000|2008-07-17|556543|RTJ|35-RTGJ|EYT
465|2008-11-10|567789|GHJ|45-DGHH|ETU
533|2008-09-06|567789|GHJ|45-DGHH|ETU
How does sort do it?
sort -t '|' +0 -1 -n +1 -2 +2 -3 -o list list
According to the following :
`+POS1[-POS2]'
The obsolete, traditional option for specifying a sort field.
The field consists of the line between POS1 and up to but _not
including_ POS2 (or the end of the line if POS2 is omitted).
Fields and character positions are numbered starting with 0.
See below.
Then if u see the sort cmd,the sorting will take place between +1 and upto but not including - 2.Now this is confusing what field will refer to 000 or 2008-07-17.
The field 000 is Field 1 and 2008-07-17 is Field 2.Sorting will take place according to which field and what algorithm ,numerical order or what?
Reading for comprehension is not your strong point I gather.Fields and character positions are numbered starting with 0.
And I noticed you fixed the | for :. So we start by sorting field 0 (up to but not including 1, so just field 0), numerically (that's what -n says, right there in what I copied), then field 1, then field 2.