I have file with de-limited values in random order shown below, where C1V0 represents column1 value1,
C2V0 represents column2 value 2, and so on.
Column0 is a constant value which i didn't represent in the sample input format.
Column1 is a numeric column.
Column2 is a timestamp (yyyy-mm-dd hh:mm:ss)
Column3 is numeric column.
And also all C3V0 values are one and the same. And all C1V1 values are same etc.
I'm using this sort command
And it gives me o/p as :
But I want to get the output as :
what change should i do to get the expected output?
---------- Post updated at 03:54 PM ---------- Previous update was at 01:56 PM ----------
never min got my solution.
Last edited by radoulov; 04-07-2012 at 08:36 AM..
Reason: Change quote tags to code (Scrutinizer), Marked as solved (radoulov)
Can any one please tell me where the error in below script. Output is not as per my requirement. if condition not comparing the result of record count of a file with 1. where is the pbm in my script? Appreciate your help..
#!/bin/ksh
#Module-
#Summary- To move the file to direcotries if... (9 Replies)
-rw-r--r-- 1 oracle oinstall 4 Jan 17 16:23 a
-rw-r--r-- 1 oracle oinstall 212 Jan 17 17:51 amar
-rw-r--r-- 1 oracle oinstall 32 Jan 17 17:30 b
-rw-r--r-- 1 oracle oinstall 246 Jan 17 15:40 h1.tar.gz
Hi,
I want combination of linux command to sort out the line which has 32k size.
... (5 Replies)
I have ran into a heavy case of PEBCAK*) and could need some advice on what i do wrong:
OS is Linux (kernel 2.6.35), sort --version reports "8.5" from 2010, shell is ksh.
Originally i had a file with with the following structure:
hdisk1 yyy
hdisk2 yyy
hdisk3 yyy
hdisk4 yyy
hdisk5 yyy... (2 Replies)
RedHat 5
KSH
I am creating an array, and then using case to go through and count for specific words. Then the count gets stored as an expression.
string='ftp rcp rsh telnet ftp ftp'
set -A myarray $string
FTPCOUNT="0"
for command in ${myarray}
do
case $command in
ftp) FTPCOUNT=`expr... (2 Replies)
hi,
I have been trying to acheive the following task for a while now, but failed.. Need help, experts please help!
This is what I am trying to do:
- I am writing to a flat file the name of the source to be copied and the destination path as to where it is to be copied to.
Sample flat file:... (7 Replies)
I'm looking at a line in a script:
&& DRROOT="/dir1" || DRROOT="/dir2" I'm trying to understand it.
Is there a "-d" command and is it seeing if /dir1 exists and, if so, set an environment variable named DRROOT to "/dir1", else set DRROOT to "/dir2" ?
Thanks,
-dog
---------- Post... (0 Replies)
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)
cat test.ksh
#!/usr/bin/ksh
VAR="Dear Friends \n How are you? \n Have a nice day \n"
export VAR
echo "Inside test.ksh";
./test.pl
cat test.pl
#!/usr/bin/perl
print "Inside test.pl \n";
print "$VAR";
Output:
./test.ksh
Inside test.ksh
Inside test.plWhat I want to achieve is, I... (1 Reply)
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)
I've a simple .sh file:
#!/bin/ksh
sort -t: -k 1.13,1.13 -k 1.16,1.29 sort.txt > output.txt
When i try to run this sort.sh file
./sort.sh
it gives me the error:
ksh: ./sort.sh: not found
I've tried the following:
1) echo $SHELL
/bin/ksh
2) echo $PATH... (4 Replies)