Create an array element for each date and hour. So for simplicity, filter this output to awk again:
Code:
awk -F"[: ]" '{ ts[$1 "." $2]++;} END { for (key in ts) { print ts[key] " lines at " key ":00"; }'
Do you see it now? Array indexes in awk are just strings (called associative arrays or hashes). So you create the index based on the first field (the date) and the second field (the hour). If the array index already exists, the code increments what's already there. Otherwise, it just becomes 1. You can also do two-dimension arrays in awk. Check the man pages for how to do that, though.
Ok here is the deal, I have a command given to me by some systems guy who I cannot get ahold of on the weekend without paying him alot of money to help me. I need to get this done before Monday as I am just getting pummeled by DOS attacks. The comand given was....
netstat -ntu | awk '{print... (1 Reply)
How can I sort lines in a file in a consistent, user-defined way that is not alphabetical, numeric, or patterned in any other way (e.g., sort a bunch of 5 line files to always print lines 2,5,3,4,1)? Thanks in advance. (4 Replies)
HI,
I have been racking my brain for a while on this..... was hoping one of the guru's could point me in the right direction....
Basically I have the following data in a file :
----
2009-01-01 10665 Begin 02:25:23
2009-01-02 10665 Begin 20:54:11
2009-01-03 10665 Begin 05:31:17... (4 Replies)
i have list of files:
Wang CVPR 09.pdf
Yaacob AFGR 99.pdf
Shi CVPR 04.pdf
.....
how can i sort with single line this directory so the output will be in the next format:
<year>\t<conference/journal>\t<author list> - t is tab
(its sort by the year)
example:
1999 CVIU ... (2 Replies)
i have list of files:
Wang De Wong CVPR 09.pdf
Yaacob AFGR 99 Second edition.pdf
Shimon CVPR 01.pdf
Den CCC 97 long one.pdf
Ronald De Bour CSPP 04.pdf
.....
how can i sort this directory so the output will be in the next format:
<year>\t<conference/journal>\t<author list> - t is tab
(its... (1 Reply)
hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this;
192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
Hi, I have posted related topic but as i continue the research I find more need to sort the data.
AS(2607:f278:4101:11:dead:beef:f00f:f), AS786 AS6453 AS7575 AS7922
AS(2607:f2e0:f:1db::16), AS786 AS3257 AS36252
AS786 AS3257 AS36252
AS(2607:f2f8:1700::2), AS786 AS6939 AS25795 ... (6 Replies)
Hi all,
Does anyone can help me the following question? I would like to write an AWK script.
In the following input file, each number in "start" is paired with numbers in column "end".
No Start End
A 22,222,33,22,1233,3232,44 555,333,222,55,1235,3235,66... (7 Replies)
Hi fellow linuxers
I have a quick question... I would like to sort the numbers in each line that are within a file, and I want to sort them so that the numbers in each line go from SMALLEST to HIGHEST. For example, my file looks like this:
6 4 2 3 1 5 7 8
15 16 11 13 12 14 20 18 19 17
24 26... (7 Replies)
Hi, guys
I just wanted to sort the elements of an array ascendingly.
I know the following code does work well:
array=(13 435 8 23 100)
for i in {0..4}
do
j=$((i+1))
while ]
do
if } -le ${array} ]]
then :
else
min=${array}
${array}=${array}
${array}=$min
fi... (5 Replies)
Discussion started by: franksunnn
5 Replies
LEARN ABOUT HPUX
tt_default_session_set
tt_default_session_set(library call) tt_default_session_set(library call)
NAME
tt_default_session_set -- set the current default session identifier
SYNOPSIS
#include <Tt/tt_c.h>
Tt_status tt_default_session_set(
const char *sessid);
DESCRIPTION
The tt_default_session_set function sets the current default session identifier.
The ToolTalk service uses the initial user session as the default session and supports one session per procid. The application can make
this call before it calls tt_open(3) to specify the session to which it wants to connect.
The sessid argument is a pointer to the unique identifier for the session in which the procid is interested.
RETURN VALUE
Upon successful completion, the tt_default_session_set function returns the status of the operation as one of the following Tt_status val-
ues:
TT_OK The operation completed successfully.
TT_ERR_NOMP
The ttsession(1) process is not running and the ToolTalk service cannot restart it.
TT_ERR_PROCID
The current default process identifier is out of date or invalid.
TT_ERR_SESSION
The specified ToolTalk session is out of date or invalid.
APPLICATION USAGE
To change to another opened session, the application must use the tt_default_procid_set function.
To join other sessions, the procid must first set the new session as the default session, and then initialize and register with the
ToolTalk service. The calls required must be in the following order:
tt_default_session_set
tt_open
The tt_open(3) may create another ToolTalk procid, the connection to which is identified by a procid. Only one ToolTalk session per procid
is allowed. (However, multiple procids are allowed in a client.) There are no API calls to determine to which session a particular procid
is connected. If it is important for the application to know the session to which it is connected, it must make the following calls in the
indicated order:
tt_open
tt_default_session
The application can then store the information by indexing it by the procid returned by the tt_open(3) call.
SEE ALSO
Tt/tt_c.h - Tttt_c(5), tt_open(3), tt_default_procid(3), tt_default_session(3).
tt_default_session_set(library call)