03-24-2015
A line with no number before other (non-blank) text is treated as zero. Combining the -n and -u options causes all but one of the lines with the same numeric value to be deleted. So the empty lines and the lines containing 0 sort together and the -u throws out all but one of those lines. (And, you are left seeing an empty line between the -1 and the 11.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. Programming
#include <iostream>
using namespace std;
int main()
{
const int l_test = 999999999;
int *l_ptr = (int*) &l_test;
cout<<"Constant Addr:"<<&l_test<<" Value:"<<l_test<<endl;
cout<<"Pointer Addr:"<<l_ptr<<" Value:"<<*l_ptr<<endl;
*l_ptr = 888888888; // Manipulating... (2 Replies)
Discussion started by: helpmenow
2 Replies
2. Shell Programming and Scripting
I have got a file BeforeSort.txt having 40 fields seperated by "|"
First field= RecordType (Value will be P or FP)
Second field= CamCode
Third field = UpdatingDate
Fourth field = ProductType
Fifth field = ActionCode (Value may be 01, 02 or 03)
Sixth field = ProductCode
and so on
My... (1 Reply)
Discussion started by: pankajrai
1 Replies
3. UNIX for Advanced & Expert Users
Hi guys,
I have the following example data:
A;00:00:19
B;00:01:02
C;00:00:13
D;00:00:16
E;00:02:27
F;00:00:12
G;00:00:21
H;00:00:19
I;00:00:13
J;00:13:22
I run the following sort against it, yet the output is as follows:
sort -t";" +1 -nr example_data.dat
A;00:00:19 (16 Replies)
Discussion started by: miwinter
16 Replies
4. Shell Programming and Scripting
i 've noticed the following difference between freebsd cp and gnu cp
from the freebsd cp man page:
-R ... If the source_file ends in a /, the contents of the directory are copied rather than
the directory itself. ...
on gnu cp from the man pagewhile on gnu cp manpage:
‘-r'... (2 Replies)
Discussion started by: aegis
2 Replies
5. UNIX for Dummies Questions & Answers
Hi
Don't know if this is a dummy question, but let's give it a try.
I yesterday had a problem with undefined behaviour in the sort shell command (I'm using bash), leading to different sort orders without apparent reasons. I resolved this by typing
export LC_ALL="C"
export LC_COLLATE="C"... (5 Replies)
Discussion started by: jossojjos
5 Replies
6. Shell Programming and Scripting
Hi to all.
I'm trying to sort this with the Unix command sort.
user1:12345678:3.5:2.5:8:1:2:3
user2:12345679:4.5:3.5:8:1:3:2
user3:12345687:5.5:2.5:6:1:3:2
user4:12345670:5.5:2.5:5:3:2:1
user5:12345671:2.5:5.5:7:2:3:1
I need to get this:
user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies
7. UNIX for Advanced & Expert Users
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
8. Programming
fg = foreground bg = background
I have a cobol program that I start with a very simple script.
The script is not at fault as it has not changed and the program worked in fg and bg before.
I have altered the logging in the program and moved my cursor declare to working storage.
The program runs... (6 Replies)
Discussion started by: Bruble
6 Replies
9. Shell Programming and Scripting
Input file:
100%ABC2 3.44E-12 USA
A2M%H02579 0E0 UK
100%ABC2 5.34E-8 UK
100%ABC2 3.25E-12 USA
A2M%H02579 5E-45 UK
Output file:
100%ABC2 3.44E-12 USA
100%ABC2 3.25E-12 USA
100%ABC2 5.34E-8 UK
A2M%H02579 0E0 UK
A2M%H02579 5E-45 UK
Code try:
sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies
10. 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