grep is not the correct tool to do this, here are some ways you could do it.
Also in you file you can use the . as a dilimiter. It is probably better to do so
then to depend on having 'n' characters.
Hi
I need to search for matching strings in a database and I want to print out all files that matches in "detail", which means that I want the output to contain datum of last saving. I only get the grep function tp print the actual file names which is not enough since the database is to large... (14 Replies)
I have a question about the accuracy of prstat.
I did a 'prstat -t' and it shows 99% of my memory is occupied by oracle.
NPROC USERNAME SIZE RSS MEMORY TIME CPU
194 oracle 343G 340G 99% 86:17.24 56%
However, 'top' shows I still have 7762meg of memory free.
Memory: 16G real, 7762M... (4 Replies)
Hi,
i have to search for a char like that :
export var1="i am not happy /not happy"
with a command like :
grep $var1 file
but this not working with me !!!
thank you in advance. (2 Replies)
Dear Friends,
I have my command output which displays on one row and values are now scrollable (vertical) 3 pages. How do i display those output in three column so that i no need to scroll?
Example:
dcadd$cat components
1.Caluculator
2.Diary
...
...
50.Mobile
51.Battery
..
...... (12 Replies)
Hi ,
I am not familiar with shell programming. I have a requirement like i have two files
.I need to compare the two files by comparing each parameter and i should produce 2 outputs.
1)i have around 35 parameters say i have one parameter name called db_name=dcap in one file and... (7 Replies)
I have an overnight script which runs across a large directory to repair permissions and ownership. I also have this command output the list of files affected so that cron can email these as a log file. Previously I had the command in the form:
find /path/to/files -not -user myname -print -exec... (4 Replies)
Hello guys,
I have been looking around but can't find the answer to my problem:
If the grep command displays no results, print "no results have been found" and increment x. But if the grep command find something, do nothing.
if
echo "no results have been found $x"
x=`expr $x + 1 `... (3 Replies)
Hi, perhaps this is a dumb question.
I'm running queries on mysql and I'm getting tabbed results like these:
mysql> SELECT * from metrics_status WHERE date = '2012-03-30';
<TABLE... (1 Reply)
I have a file like this:
AAEQGAGNQPQH,,,,160,32,,,,
AAGQDYNSPLH,,712,39,,,,,,
AAGREGGNTEAF,26,,,,,,,,4
AAGSPQH,,,,8,5,,,,
AAKKLGQFYNEQF,4,,6,,,7,,,2
AANSGGRYNEQF,,2747,3120,,,,,,
AAQGGVGGELF,,,,5,,12,36,,
AAQGLAGYYEQY,,25,13,,,,,,
AAQRGNEQF,510,2,,,6,,6,,76
AAQTGENSPLH,,16,16,,,,,,
The... (9 Replies)
Discussion started by: xshang
9 Replies
LEARN ABOUT XFREE86
sd_uid_get_state
SD_UID_GET_STATE(3) sd_uid_get_state SD_UID_GET_STATE(3)NAME
sd_uid_get_state, sd_uid_is_on_seat, sd_uid_get_sessions, sd_uid_get_seats - Determine login state of a specific Unix user ID
SYNOPSIS
#include <systemd/sd-login.h>
int sd_uid_get_state(uid_t pid, char** state);
int sd_uid_is_on_seat(uid_t pid, int require_active, const char* seat);
int sd_uid_get_sessions(uid_t pid, int require_active, char*** sessions);
int sd_uid_get_seats(uid_t pid, int require_active, char*** seats);
DESCRIPTION
sd_uid_get_state() may be used to determine the login state of a specific Unix user identifier. The following states are currently known:
offline (user not logged in at all), lingering (user not logged in, but some user services running), online (user logged in, but not
active), active (user logged in on an active seat). In the future additional states might be defined, client code should be written to be
robust in regards to additional state strings being returned. The returned string needs to be freed with the libc free(3) call after use.
sd_uid_is_on_seat() may be used to determine whether a specific user is logged in or active on a specific seat. Accepts a Unix user
identifier and a seat identifier string as parameters. The require_active parameter is a boolean. If non-zero (true) this function will
test if the user is active (i.e. has a session that is in the foreground and accepting user input) on the specified seat, otherwise (false)
only if the user is logged in (and possibly inactive) on the specified seat.
sd_uid_get_sessions() may be used to determine the current sessions of the specified user. Acceptes a Unix user identifier as parameter.
The require_active boolean parameter controls whether the returned list shall consist of only those sessions where the user is currently
active (true) or where the user is currently logged in at all, possibly inactive (false). The call returns a NULL terminated string array
of session identifiers in sessions which needs to be freed by the caller with the libc free(3) call after use, including all the strings
referenced. If the string array parameter is passed as NULL the array will not be filled in, but the return code still indicates the number
of current sessions. Note that instead of an empty array NULL may be returned and should be considered equivalent to an empty array.
Similar, sd_uid_get_seats() may be used to determine the list of seats on which the user currently has sessions. Similar semantics apply,
however note that the user may have multiple sessions on the same seat as well as sessions with no attached seat and hence the number of
entries in the returned array may differ from the one returned by sd_uid_get_sessions().
RETURN VALUE
On success sd_uid_get_state() returns 0 or a positive integer. If the test succeeds sd_uid_is_on_seat() returns a positive integer, if it
fails 0. sd_uid_get_sessions() and sd_uid_get_seats() return the number of entries in the returned arrays. On failure, these calls return
a negative errno-style error code.
NOTES
The sd_uid_get_state(), sd_uid_is_on_seat(), sd_uid_get_sessions(), and sd_uid_get_seats() interfaces are available as shared library,
which can be compiled and linked to with the libsystemd-login pkg-config(1) file.
SEE ALSO systemd(1), sd-login(7), sd_pid_get_owner_uid(3)AUTHOR
Lennart Poettering <lennart@poettering.net>
Developer
systemd 10/07/2013 SD_UID_GET_STATE(3)