Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Any way to sort ps output based on STIME? Post 303039550 by newbie_01 on Wednesday 9th of October 2019 07:49:14 AM
Old 10-09-2019
Any way to sort ps output based on STIME?

Hi,

This is one of the thing that am looking for when I post the question on the ps wrapper. It has since been closed as it has taken me too long to post an example.

I have replaced some of the original content of the ps output.

uname -a = SunOS <hostname> 5.11 11.3 sun4v sparc sun4v

Code:
= This is the current output

$: ps -ef | grep pmon | grep -i abc | grep -v grep

     UID   PID  PPID   C    STIME TTY         TIME CMD
  oracle 27452 16899   0   Sep 15 ?           5:42 ora_pmon_abcd9
  oracle  9843 16899   0   Sep 15 ?           4:50 ora_pmon_abcd11
  oracle 28017 16899   0   Sep 26 ?           0:38 ora_pmon_abcd15
  oracle  6017 16899   0   Sep 15 ?           6:37 ora_pmon_abcd1
  oracle  8273 16899   0   Sep 15 ?           4:22 ora_pmon_abcd10
  oracle 29331 16899   0   Sep 15 ?           5:36 ora_pmon_abct1
  oracle  4154 16899   0   Sep 15 ?           4:33 ora_pmon_abct3
  oracle 24750 16899   0   Sep 15 ?           4:33 ora_pmon_abcd8
  oracle  5755 16899   0 06:28:27 ?           0:08 ora_pmon_abcd2
  oracle 23611 16899   0   Sep 15 ?           5:42 ora_pmon_abcd5
  oracle 27760 16899   0   Sep 21 ?           2:46 ora_pmon_abct11
  oracle 22935 16899   0   Sep 15 ?           5:17 ora_pmon_abcd3

= This is the current output that I am hoping to have. I just sorted the output manually below

     UID   PID  PPID   C    STIME TTY         TIME CMD
  oracle  8273 16899   0   Sep 15 ?           4:22 ora_pmon_abcd10
  oracle  4154 16899   0   Sep 15 ?           4:33 ora_pmon_abct3
  oracle 24750 16899   0   Sep 15 ?           4:33 ora_pmon_abcd8
  oracle  9843 16899   0   Sep 15 ?           4:50 ora_pmon_abcd11
  oracle 22935 16899   0   Sep 15 ?           5:17 ora_pmon_abcd3  
  oracle 29331 16899   0   Sep 15 ?           5:36 ora_pmon_abct1
  oracle 23611 16899   0   Sep 15 ?           5:42 ora_pmon_abcd5
  oracle 27452 16899   0   Sep 15 ?           5:42 ora_pmon_abcd9
  oracle  6017 16899   0   Sep 15 ?           6:37 ora_pmon_abcd1
  oracle 27760 16899   0   Sep 21 ?           2:46 ora_pmon_abct11
  oracle 28017 16899   0   Sep 26 ?           0:38 ora_pmon_abcd15
  oracle  5755 16899   0 06:28:27 ?           0:08 ora_pmon_abcd2

Can't find the right ps args to use. Not sure if there is one available tbh. Any way, hope I can get some suggestion on how to achieve the desired output that am after.

Thanks in advance.
This User Gave Thanks to newbie_01 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort based on string lenght.

I'm not familiar with find. If i use find in a certain directory i want it to show based on hierarchy. find . type d fol1 fol1/subfol1 fol1/subfol1/subfol1 fol2 fol2/subfol2 i want it to show like this fol1/subfol1/subfol1 fol1/subfol1 fol1 fol2/subfol2 fol2 do i need to use... (5 Replies)
Discussion started by: ryandegreat25
5 Replies

2. Shell Programming and Scripting

Converting line output to column based output

Hi Guys, I am trying to convert a file which has a row based output to a column based output. My original file looks like this: 1 2 3 4 5 6 1 2 3 1 2 3 (8 Replies)
Discussion started by: npatwardhan
8 Replies

3. Shell Programming and Scripting

sort by based on multiple columns

Hi, Is there any way to sort a file in cshell by sort command, sorting it by multiple fields, like to sort it first by the second column and then by the first column. Thanks forhead (1 Reply)
Discussion started by: Takeeshe
1 Replies

4. Shell Programming and Scripting

Sort file based on column

Hi, My input file is $cat samp 1 siva 1 raja 2 siva 1 siva 2 raja 4 venkat i want sort this name wise...alos need to remove duplicate lines. i am using cat samp|awk '{print $2,$1}'|sort -u it showing raja 1 (3 Replies)
Discussion started by: rsivasan
3 Replies

5. Shell Programming and Scripting

sort based on the own pattern

Hi Everyone, # cat 1.pl #!/usr/bin/perl use strict; use warnings; my @test=("a","b","c","d"); print @test; # ./1.pl abcd if i want to sort the @test, based on my own partten, the output is "cbda", how to do? as i know perl sort i can use cmp and <=>, but how to do with my own... (7 Replies)
Discussion started by: jimmy_y
7 Replies

6. Shell Programming and Scripting

Sort and extract based on two files

Hi, I am having trouble sorting one file based on another file. I tried the grep -f function and failed. Basically what I have is two files that look like this: File 1 (the list) gh aba for hmm File 2 ( the file that needs to be sorted) aba 2 4 6 7 for 2 4 7 4 hmm 1 ... (3 Replies)
Discussion started by: phil_heath
3 Replies

7. Shell Programming and Scripting

Sort based on filenames

Hi All, When i give ls -ltr my filenames looks like this: Filename Pattern: Abc_Def_mmddyyyyHHmm.csv $ ls -ltr Jun 05 04:30 Abc_Def_060520111245.csv Jun 05 08:40 Abc_Def_071220121458.csv Jun 06 03:30 Abc_Def_071220111458.csv Jun 06 04:25 Abc_Def_060620110439.csv Jun 07 04:37... (12 Replies)
Discussion started by: HemaV
12 Replies

8. Shell Programming and Scripting

Sort based on numbers

I have a file which has the following data :- how can I sort the data in descending order . My files may have the first column with 1 to 10000 numbers .I need to arrange them in descending order . Thanks (2 Replies)
Discussion started by: lazydev
2 Replies

9. Shell Programming and Scripting

Sort based on certain value in a column

Hi, i need to sort content of files based on a specific value. An example as below. Input1.txt Col_1 SW_MH2_ST ST_F72_9S SW_MH3_S6 Col_2 SW_MH3_AS7 ST_S15_9CH SW_MH3_AS8 SW_MH3_ST Col_3 ST_M93_SZ ST_C16_TC (12 Replies)
Discussion started by: redse171
12 Replies

10. UNIX for Beginners Questions & Answers

Sort based on one column

Hi All , I am having an input file like this Input file 7 sks/jsjssj/ddjd/hjdjd/hdhd/Q 10 0.5 13 dkdkd/djdjd/djdjd/djd/QB 01 0.5 ldld/dkd/jdf/fjfjf/fjf/Q 0.5 10 sjs/jsdd/djdkd/dhd/Q 01 0.5 21 kdkd/djdd/djdd/jdd/djd/QB 01 0.5 dkdld/djdjd/djd/Q 01 0.5 ... (9 Replies)
Discussion started by: kshitij
9 Replies
SORT(1) 							   User Commands							   SORT(1)

NAME
sort - sort lines of text files SYNOPSIS
sort [OPTION]... [FILE]... sort [OPTION]... --files0-from=F DESCRIPTION
Write sorted concatenation of all FILE(s) to standard output. Mandatory arguments to long options are mandatory for short options too. Ordering options: -b, --ignore-leading-blanks ignore leading blanks -d, --dictionary-order consider only blanks and alphanumeric characters -f, --ignore-case fold lower case to upper case characters -g, --general-numeric-sort compare according to general numerical value -i, --ignore-nonprinting consider only printable characters -M, --month-sort compare (unknown) < `JAN' < ... < `DEC' -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G) -n, --numeric-sort compare according to string numerical value -R, --random-sort sort by random hash of keys --random-source=FILE get random bytes from FILE -r, --reverse reverse the result of comparisons --sort=WORD sort according to WORD: general-numeric -g, human-numeric -h, month -M, numeric -n, random -R, version -V -V, --version-sort natural sort of (version) numbers within text Other options: --batch-size=NMERGE merge at most NMERGE inputs at once; for more use temp files -c, --check, --check=diagnose-first check for sorted input; do not sort -C, --check=quiet, --check=silent like -c, but do not report first bad line --compress-program=PROG compress temporaries with PROG; decompress them with PROG -d --files0-from=F read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input -k, --key=POS1[,POS2] start a key at POS1 (origin 1), end it at POS2 (default end of line) -m, --merge merge already sorted files; do not sort -o, --output=FILE write result to FILE instead of standard output -s, --stable stabilize sort by disabling last-resort comparison -S, --buffer-size=SIZE use SIZE for main memory buffer -t, --field-separator=SEP use SEP instead of non-blank to blank transition -T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories -u, --unique with -c, check for strict ordering; without -c, output only the first of an equal run -z, --zero-terminated end lines with 0 byte, not newline --help display this help and exit --version output version information and exit POS is F[.C][OPTS], where F is the field number and C the character position in the field; both are origin 1. If neither -t nor -b is in effect, characters in a field are counted from the beginning of the preceding whitespace. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key. SIZE may be followed by the following multiplicative suffixes: % 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y. With no FILE, or when FILE is -, read standard input. *** WARNING *** The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values. AUTHOR
Written by Mike Haertel and Paul Eggert. REPORTING BUGS
Report sort bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> Report sort translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for sort is maintained as a Texinfo manual. If the info and sort programs are properly installed at your site, the command info coreutils 'sort invocation' should give you access to the complete manual. GNU coreutils 8.5 February 2011 SORT(1)
All times are GMT -4. The time now is 05:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy