Delete duplicate data and pertain the latest month data.
Hi I have a file with following records
It contains three months of data, some data is duplicated,i need to access the latest data from the duplicate ones.
for e.g; i have foll data
As it can be seen that the records are same with difference of the month,i want to delete the duplicate records and keep the records with the latest month value
e.g; if i consider the 3rd and 5th record both are same in terms of data but i need the latest data to persist in file, which in this case it is JUl 09.
The problem is if i sort the data i will get JUN09 data as alphabetic wise JUN comes first,whereas i need JUL 09 data, if i sort it descending same problem occurs for different months. The uniq command is also not giving me the right output.
According to my logic i thought of converting the Month name to month number, and concatenate it with the year column, then sort and delete the duplicate lines, but its not working fine
Could you please suggest a shell script on this scenario.
I have data till 2011
Last edited by Franklin52; 04-01-2011 at 06:21 AM..
Reason: Please use code tags
Hi All ,
I am trying to run a shell script through a JCL . The requirement is I have a gdg base name and I need to create a script that will just check if the latest version of that gdg has data or not . If it doesnt have data RC 4 need to be returned . One more thing which is bothering me is i... (3 Replies)
Hi All ,
I am trying to run a shell script through a JCL . The requirement is I have a gdg base name and I need to create a script that will just check if the latest version of that gdg has data or not . If it doesnt have data RC 4 need to be returned . One more thing which is bothering me is i... (1 Reply)
Hi Gurus,
I'm using HP-UX B.11.23 operating system.
I've been trying to extract this log info based on the current date and month, but was having some issues as the date column which on the 4th column has a comma and the 5th column has a dot tied to it.
Here is the output from my shut... (5 Replies)
helllo there.. I really need your help..
I have my sample program like this..
<?php
// db connection
$db = "mds_reports";
if($connect = mysql_connect("172.16.8.32", "mds_reports", "password"))
$connect = mysql_select_db($db);
else... (2 Replies)
Hi everyone,
Almost everything is in the title!
Which partitions do you keep?
Which partitions do you reformat, while doing a clean install?
Personaly, I never format /var and /home partitions when I update to latest linux distribution.
It has been working quite ok up to now, but I was... (3 Replies)
Hi Guys,
Please help me with my problem here:
I have a source file:
1212 23232 343434 ASAS1 4
3212 23232 343434 ASAS2 4
3234 23232 343434 QWQW1 4
1134 23232 343434 QWQW2 4
3212 23232 343434 QWQW3 4
and a mapping... (4 Replies)
Good day for us.
I want to ask what is the manner to count total of spesific character or string in 10 latest line. I mean from Latestline - 10 line until Latest line.
Example :
If the latest line of my file is 455th line, I just want to count total of spesific string from line 446th to 455th.... (5 Replies)
Discussion started by: weslyarfan
5 Replies
LEARN ABOUT NETBSD
usermod
USERMOD(8) BSD System Manager's Manual USERMOD(8)NAME
usermod -- modify user login information
SYNOPSIS
usermod [-FmoSv] [-C yes/no] [-c comment] [-d home-dir] [-e expiry-time] [-f inactive-time] [-G secondary-group] [-g gid | name | =uid]
[-L login-class] [-l new-login] [-p password] [-s shell] [-u uid] user
DESCRIPTION
The usermod utility modifies user login information on the system.
Default values are taken from the information provided in the /etc/usermgmt.conf file, which, if running as root, is created using the built-
in defaults if it does not exist.
See user(8) for more information about EXTENSIONS.
After setting any defaults, and then reading values from /etc/usermgmt.conf, the following command line options are processed:
-C yes/no
Enable user accounts to be temporary locked/closed. The yes/no operand can be given as ``yes'' to lock the account or ``no'' to
unlock the account.
-c comment
Set the comment field (also, for historical reasons known as the GECOS field) for the user. The comment field will typically include
the user's full name and, perhaps, contact information for the user.
-d home-directory
Set the home directory without populating it; if the -m option is specified, tries to move the old home directory to home-directory.
-e expiry-time
Set the time at which the account expires. This can be used to implement password aging. It should be entered in the form ``month
day year'', where month is the month name (the first three characters are sufficient), day is the day of the month, and year is the
year. Time in seconds since the epoch (UTC) is also valid. A value of 0 can be used to disable this feature. This value can be
preset for all users using the expire field in the /etc/usermgmt.conf file. See usermgmt.conf(5) for more details.
-F Force the user to change their password upon next login.
-f inactive-time
Set the time at which the password expires. See the -e option.
-G secondary-group
Specify a secondary group to which the user will be added in the /etc/group file. The secondary-group may be a comma-delimited list
for multiple groups. Or the option may be repeated for multiple groups. (16 groups maximum.)
-g gid | name | =uid
Give the group name or identifier to be used for the user's primary group. If this is '=uid', then a uid and gid will be picked
which are both unique and the same, and a line will be added to /etc/group to describe the new group. This value can be preset for
all users by using the group field in the /etc/usermgmt.conf file. See usermgmt.conf(5) for more details.
-L login-class
Set the login class for the user. See login.conf(5) for more information on user login classes. This value can be preset for all
users by using the class field in the /etc/usermgmt.conf file. See usermgmt.conf(5) for more details. This option is included if
built with EXTENSIONS.
-l new-user
Give the new user name. It can consist of alphanumeric characters and the characters '.', '-', and '_'.
-m Move the home directory from its old position to the new one. If -d is not specified, the new-user argument of the -l option is
used; one of -d and -l is needed.
-o Allow duplicate uids to be given.
-p password
Specify an already-encrypted password for the user. This password can then be changed by using the chpass(1) utility. This value
can be preset for all users by using the password field in the /etc/usermgmt.conf file. See usermgmt.conf(5) for more details. This
option is included if built with EXTENSIONS.
-S Allow samba user names with a trailing dollar sign to be modified. This option is included if built with EXTENSIONS.
-s shell
Specify the login shell for the user. This value can be preset for all users by using the shell field in the /etc/usermgmt.conf
file. See usermgmt.conf(5) for more details.
-u uid Specify a new uid for the user. Boundaries for this value can be preset for all users by using the range field in the
/etc/usermgmt.conf file. See usermgmt.conf(5) for more details.
-v Enable verbose mode - explain the commands as they are executed. This option is included if built with EXTENSIONS.
Once the information has been verified, usermod uses pwd_mkdb(8) to update the user database. This is run in the background. At very large
sites this can take several minutes. Until this update is completed, the password file is unavailable for other updates and the new informa-
tion is not available to programs.
EXIT STATUS
The usermod utility exits 0 on success, and >0 if an error occurs.
FILES
/etc/usermgmt.conf
SEE ALSO chpass(1), group(5), passwd(5), usermgmt.conf(5), pwd_mkdb(8), user(8), useradd(8), userdel(8)HISTORY
The usermod utility first appeared in NetBSD 1.5. It is based on the addnerd package by the same author.
AUTHORS
The usermod utility was written by Alistair G. Crooks <agc@NetBSD.org>.
BSD January 13, 2009 BSD