Sponsored Content
Full Discussion: Sort -t: -k1
Top Forums UNIX for Beginners Questions & Answers Sort -t: -k1 Post 303043830 by loktamann on Friday 7th of February 2020 06:02:37 PM
Old 02-07-2020
Sort -t: -k1

My file1.txt looks like below:
Code:
Feb 03 15:58:27 2020
Feb 03 16:01:23 2020
Feb 03 16:11:29 2020
Feb 04 11:01:49 2020
Jan 20 16:27:38 2020
Jan 20 16:29:51 2020
Jan 20 16:44:39 2020
Jan 20 16:56:41 2020

I tried: sort -t: -k1 and result below:
Code:
Feb 03 15:58:27 2020
Feb 03 16:01:23 2020
Feb 03 16:11:29 2020
Feb 04 11:01:49 2020
Jan 20 16:27:38 2020
Jan 20 16:29:51 2020
Jan 20 16:44:39 2020
Jan 20 16:56:41 2020

I'd like to have Feb 04 11:01:49 2020 as the last line.
Thanks in advance!

--- Post updated at 07:02 PM ---

I tried sort -nrz and result below. close but not in order:

Code:
Jan 20 16:56:41
Feb 03 16:11:29
Jan 20 16:27:38
Jan 20 16:29:51
Feb 03 15:58:27
Feb 03 16:01:23
Jan 20 16:44:39
Feb 04 11:01:49

Moderator's Comments:
Mod Comment Please always do wrap your samples in CODE TAGS as per forum rules.

Last edited by rbatte1; 02-10-2020 at 01:58 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort

I check the man page but I still cannot see what this command is supposed to do sort +5 -6 <file> It just seems to sort the file as normal?? Thanks Calypso (3 Replies)
Discussion started by: Calypso
3 Replies

2. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

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

3. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

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

4. Shell Programming and Scripting

Is it Possible to sort a list of hexadecimal numbers using "sort" command?

Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
9 Replies

5. Shell Programming and Scripting

Help to sort out... Possible use of sort command

I have an input like 4.3.6.66 4.3.6.67 4.3.6.70 4.3.6.25 4.3.6.15 4.3.6.54 4.3.6.44 4.3.6.34 4.3.6.24 4.3.6.14 4.3.6.53 4.3.6.43 4.3.6.49 4.3.6.33 4.3.6.52 4.3.6.19 4.3.6.58 4.3.6.42 (5 Replies)
Discussion started by: dnam9917
5 Replies

6. Shell Programming and Scripting

Alternate to sort --random-sort

sort --random-sort The full command is path=`find /testdir -maxdepth 1 -mindepth 1 -type d | ***Some sort of sort function*** | head -1` I have a list I want to randomly sort. It works fine in ubuntu but on a 'osx lion' sort dosen't have the --random-sort option. I don't want to... (5 Replies)
Discussion started by: digitalviking
5 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

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

8. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

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

9. UNIX for Beginners Questions & Answers

Difference of Sort -n -k2 -k3 & Sort -n -k2,3

Hi, Could anyone kindly show me a link or explain the difference between sort -n -k2 -k3 & sort -n -k2,3 Also, if I like to remove the row with repetition at both $2 and $3, Can I safely use sort -u -k2 -k3 Example; 100 20 30 100 20 30 So, both $2 and $3 are same and I... (2 Replies)
Discussion started by: Indra2011
2 Replies

10. Shell Programming and Scripting

Use sort to sort numerical column

How to sort the following output based on lowest to highest BE? The following sort does not work. $ sort -t. -k1,1n -k2,2n bfd.txt BE31.116 0s 0s DOWN DAMP BE31.116 0s 0s DOWN DAMP BE31.117 0s 0s ... (7 Replies)
Discussion started by: sand1234
7 Replies
jstatd(1)						      General Commands Manual							 jstatd(1)

NAME
jstatd - Virtual Machine jstat Daemon SYNOPSIS
jstatd [ options ] DESCRIPTION
The jstatd tool is an RMI server application that monitors for the creation and termination of instrumented HotSpot Java virtual machines (JVMs) and provides a interface to allow remote monitoring tools to attach to JVMs running on the local host. The jstatd server requires the presence of an RMI registry on the local host. The jstatd server will attempt to attach to the RMI registry on the default port, or on the port indicated by the -p port option. If an RMI registry is not found, one will be created within the jstatd application bound to the port indicated by the -p port option or to the default RMI registry port if -p port is omitted. Creation of an internal RMI registry can be inhibited by specifying the -nr option. NOTE - This utility is unsupported and may or may not be available in future versions of the J2SE SDK. It is not currently available on the Windows 98 and Windows ME platforms. PARAMETERS
options Command-line options. The options may be in any order. If there are redundant or contradictory options, the last option specified will take precedence. OPTIONS
The jstatd command supports the following options: -nr Do not attempt to create an internal RMI registry within the jstatd process when an existing RMI registry is not found. -p port Port number where the RMI registry is expected to be found, or, if not found, created if -nr is not specified. -n rminame Name to which the remote RMI object is bound in the RMI registry. The default name is JStatRemoteHost. If multiple jstatd servers are started on the same host, the name of the exported RMI object for each server can be made unique by by specify- ing this option. However, doing so will require that the unique server name be included in the monitoring client's hostid and vmid strings. -Joption Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes. It is a common convention for -J to pass options to the underlying VM executing applications written in Java. SECURITY
The jstatd server installs an instance of RMISecurityPolicy if no other security manager has been installed and therefore requires a secu- rity policy file to be specified. The policy file must conform to the default policy implementation's Policy File Syntax. The policy file can be specified with the -J-Djava.security.policy=file The following policy file will allow the jstatd server to run without any security exceptions. This policy is less liberal then granting all permissions to all codebases, but is more liberal than a policy that grants the minimal permissions to run the jstatd server. grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; }; To use this policy, copy the text into a file called jstatd.all.policy and run the jstatd server as follows: jstatd -J-Djava.security.policy=jstatd.all.policy For sites with more restrictive security practices, Sun recommends that the jstatd security policy be customized to meet your specific needs. The jstatd server can only monitor JVMs for which it has the appropriate access permissions. However, jstatd does not perform any user level authentication or authorization checking. Therefore, it opens access to the instrumentation exported by the JVMs for which the jstatd server has the appropriate access permissions, allowing arbitrary users on the network to monitor JVMs that might otherwise be inac- cessible. Such exposure may be unacceptable in your environment. Particular care should be exercised when running the jstatd server with credentials that allow wide exposure, such as running the server with root permissions on UNIX based systems. The exposure introduced by the jstatd server can be eliminated by not running the server, thus requiring all monitoring activities to be performed locally. Alternatively, the security policy file can be customized to limit access to specific trusted hosts. REMOTE INTERFACE
The interface exported by the jstatd process is proprietary and is guaranteed to change. Users and developers are discouraged from writing to this interface. EXAMPLES
Here are some examples of starting jstatd. Note that the jstatd scripts automatically start the server in the background. Using Internal RMI Registry This example demonstrates starting jstatd with an internal RMI registry. This example assumes that no other server is bound to the default RMI Registry port (port 1099). jstatd -J-Djava.security.policy=all.policy Using External RMI Registry This example demonstrates starting jstatd with a external RMI registry. rmiregistry& jstatd -J-Djava.security.policy=all.policy This example demonstrates starting jstatd with an external RMI registry server on port 2020. rmiregistry 2020& jstatd -J-Djava.security.policy=all.policy -p 2020 This example demonstrates starting jstatd with an external RMI registry on port 2020, bound to name AlternateJstatdServerName. rmiregistry 2020& jstatd -J-Djava.security.policy=all.policy -p 2020 -n AlternateJstatdServerName Inhibiting creation of an in-process RMI registry This example demonstrates starting jstatd such that it will not create a RMI registry if one is not found. This example assumes an RMI reg- istry is already running. If it is not, an appropriate error message is emitted. jstatd -nr Enabling RMI logging capabilities This example demonstrates starting jstatd with RMI logging capabilities enabled. This technique is useful as a troubleshooting aid or for monitoring server activities. jstatd -J-Djava.security.policy=all.policy -J-Djava.rmi.server.logCalls=true This example uses the Bourne Shell syntax for setting environment variables, other shells or command interpreters may require different syntax. SEE ALSO
java(1) jps(1) jstat(1) rmiregistry(1) 13 June 2004 jstatd(1)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy