10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Input.txt
123,ABC,XYZ1,A01,IND,I68,IND,NN
123,ABC,XYZ1,A01,IND,I67,IND,NN
998,SGR,St,R834,scot,R834,scot,NN
985,SGR0399,St,R180,T15,R180,T1,YY
985,SGR0399,St,R180,T15,R180,T1,NN
985,SGR0399,St,R180,T15,R180,T1,NN
2943,SGR?99,St,R68,Scot,R77,Scot,YY... (2 Replies)
Discussion started by: unme
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I want to find row-wise average of multiple columns based on 2 columns.
I have 30k values in the matrix with 94 cols.
Example Input for cols 4 and 5 as keys
1 2 3 a 1
4 5 6 a 1
4 2 0 a 1
1 2 3 b 2
5 6 7 b 2
9 7 5 b 2
Output
3 3 3 a 1
5 5 5 b 2Here is what I have tried,... (5 Replies)
Discussion started by: ritakadm
5 Replies
3. Shell Programming and Scripting
Hi,
I'm not a regular coder but some times I write some basic perl script, hence Perl is bit difficult for me :).
I'm merging two files a.txt and b.txt into c.txt:
a.txt
------
x001;frtb70;xyz;109
x001;frvt65;sec;239
x003;wqax34;jul;659
x004;yhud43;yhn;760
b.txt
------... (8 Replies)
Discussion started by: Lokesha
8 Replies
4. Shell Programming and Scripting
Can you guys pls take a look at this.
I need to sort this list of numbers as follows:
2nd col first, then 1st col, then 3rd col, all in reverse (highest to lowest).
I'm doing this:
sort -k 2,2nr -k 1,1nr -k 3,3gr
but, as you see, the 3rd col does not get sorted properly.
Any idea... (0 Replies)
Discussion started by: mamboknave
0 Replies
5. Shell Programming and Scripting
Hello
If you wanted to sort a .csv file that was filled with lines like this:
<Ticker>,<Date as YYYYMMDD>,<Time as H:M:S>,<Volume>,<Corr>
(H : , M, S: )
by date, does anybody know of a better solution than to turn the 3rd and 4th colons of every line into commas, sorting on four keys,... (20 Replies)
Discussion started by: Ryan.
20 Replies
6. Shell Programming and Scripting
Hi,
I have below as i/p file:
5ABC 36488989 K 000010000ASB BYTRES
5PQR 45757754 K 000200005KPC HGTRET
5ABC 36488989 K 000045000ASB HGTRET
5GTH 36488989 K 000200200ASB BYTRES
5FTU ... (2 Replies)
Discussion started by: nirnkv
2 Replies
7. UNIX for Dummies Questions & Answers
I need a script (perl or awk..anything is fine) to join 3 files based on three key columns. The no of non-key columns can vary in each file. The columns are delimited by semicolon.
For example,
File1
Dim1;Dim2;Dim3;Fact1;Fact2;Fact3;Fact4;Fact5
---- data delimited by semicolon ---
... (1 Reply)
Discussion started by: Sebben
1 Replies
8. Shell Programming and Scripting
Data I want to sort :-
1 10 jj Y
2 100 vv B
19 5 jj A
1 11 hq D
3 8 op X
44 78 ds GG
1 8 hq D
and want to sort based on the first 2 columns - which hold numeric values.
Am using :
cat filename | sort -nk 1,2
But the result is :-
1 10 jj Y
1 11 hq D (1 Reply)
Discussion started by: sinpeak
1 Replies
9. UNIX for Advanced & Expert Users
Hello,
I am trying to sort a text file by two keys but the second key should be reversed.
I have tried -nt '|' -k 4 -rk 5 but it just sorts reversed on key 4.
Does anyone have any suggestions ?
Thanks (8 Replies)
Discussion started by: clarcombe
8 Replies
10. UNIX for Advanced & Expert Users
Hello,
Say I have a file with plain text as shown below. Some columns may have multiple words (like "DESC 1", "DESC 1 2", "DESC 1 2 3"). Let's say the file below has 4 columns: 1st(AA), 2nd(BB), 3rd(DESC 1, ...), 4th(CC 1, ...).
1234567890123456789012345678901234567890
AA BB DESC 1... (1 Reply)
Discussion started by: teqmem
1 Replies