05-12-2010
Can you provide a sample of the file? What is the format of each line and the date stamp.
Does the data already exist or are you also trying to define the data format?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to calculate the number of pipe delimiters in a file for all lines seperately.
For eg:i have a file Project.txt
Mohit|chawla|123|678
File1|File2|345|767|678
And my file contains many lines like this
it shd give me the output as
4
5
or give me the output for all the... (0 Replies)
Discussion started by: Mohit623
0 Replies
2. Shell Programming and Scripting
I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date.
$file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z
really appreciate any help.
thanks
mkneni (4 Replies)
Discussion started by: MKNENI
4 Replies
3. Programming
How can I compare two integer values which is stored in char pointers?
suppose I have char *a and char *b having values 10 and 20. how can i find the shorter value? (1 Reply)
Discussion started by: naan
1 Replies
4. Linux
Daily one file will dropped into this directory.
Directory: /opt/app/jt/drop
File name: XXXX_<timestamp>.dat.gz
I need to write a script which checks whether the file is dropped daily or not.
Any idea in the script how can we compare timestamp of the file to today's date?? (3 Replies)
Discussion started by: Rajneel
3 Replies
5. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Discussion started by: kumarmsk1331
0 Replies
6. Red Hat
hey, i have stored values of query like this
val_2=$( sqlplus -s rte/rted1@rel75d1 << EOF
set heading off
select source_id from cvt_istats where istat_id > $val_1;
exit
EOF
)
echo $val_2
now , val_2 has five values displayed like this
1
2
3
4
5
what i have to do is to check the... (1 Reply)
Discussion started by: ramsavi
1 Replies
7. Shell Programming and Scripting
Hi gurus..
Am reading a file, counting number of lines and storing it in a variable. Then am passing that variable into If loop for comparision, if the number of lines are greater than 1000 it should split a file if not it should send the file name to archive folder.. but when i execute the... (4 Replies)
Discussion started by: azherkn3
4 Replies
8. Shell Programming and Scripting
I need to develop a script where I will take two date arguments as parameter date1 and date2 which will in format YYYYMM.
Below is the input file say sample.txt.
sample.txt will have certain blocks starting with P1.
Each block will have a value 118,1:TIMESTAMP.
I need to compare the... (7 Replies)
Discussion started by: garvit184
7 Replies
9. Shell Programming and Scripting
I am not able to pass date stored in a variable as an argument to date command. I get current date value for from_date and to_date
#!/usr/bin/ksh
set -x
for s in server ; do
ssh -T $s <<-EOF
from_date="12-Jan-2015 12:02:09"
to_date="24-Jan-2015 13:02:09"
echo \$from_date
echo... (7 Replies)
Discussion started by: raj48
7 Replies
10. Shell Programming and Scripting
Hi Forum.
I have the following challenge at work that I need to write a script for.
I have a file abc.txt with the following contents:
4560123456
4570987654
4580654321
I want to be able to search/replace in abc.txt - the first 4 characters anything starting with 4560 to 7777; 4570... (3 Replies)
Discussion started by: pchang
3 Replies
LEARN ABOUT NETBSD
lastlog
UTMP(5) BSD File Formats Manual UTMP(5)
NAME
utmp, wtmp, lastlog -- login records
SYNOPSIS
#include <utmp.h>
DESCRIPTION
The file <utmp.h> declares the structures used to record information about current users in the file utmp, logins and logouts in the file
wtmp, and last logins in the file lastlog. The time stamps of date changes, shutdowns and reboots are also logged in the wtmp file.
The wtmp file can grow rapidly on busy systems, and is normally rotated with newsyslog(8).
These files must be created manually; if they do not exist, they are not created automatically.
#define _PATH_UTMP "/var/run/utmp"
#define _PATH_WTMP "/var/log/wtmp"
#define _PATH_LASTLOG "/var/log/lastlog"
#define UT_NAMESIZE 8
#define UT_LINESIZE 8
#define UT_HOSTSIZE 16
struct lastlog {
time_t ll_time;
char ll_line[UT_LINESIZE];
char ll_host[UT_HOSTSIZE];
};
struct utmp {
char ut_line[UT_LINESIZE];
char ut_name[UT_NAMESIZE];
char ut_host[UT_HOSTSIZE];
time_t ut_time;
};
Each time a user logs in, the login(1) program looks up the user's UID in the file lastlog. If it is found, the timestamp of the last time
the user logged in, the terminal line and the hostname are written to the standard output, providing the login is not set quiet; see
login(1). The login(1) program then records the new login time in the file lastlog.
After the new lastlog record is written, the file utmp is opened and the utmp record for the user inserted. This record remains there until
the user logs out at which time it is deleted (by clearing the user and host fields, and updating the timestamp field). The utmp file is
used by the programs rwho(1), users(1), w(1), and who(1).
Next, the login(1) program opens the file wtmp, and appends the user's utmp record. When the user logs out, a utmp record with the tty line,
an updated time stamp, and cleared user and host fields is appended to the file by init(8). The wtmp file is used by the programs last(1)
and ac(8).
In the event of a date change, a shutdown or reboot, the following items are logged in the wtmp file.
reboot
shutdown A system reboot or shutdown has been initiated. The character '~' is placed in the field ut_line, and reboot or shutdown in the
field ut_name (see shutdown(8) and reboot(8)).
date The system time has been manually or automatically updated by date(1). The command name date is recorded in the field ut_name.
In the field ut_line, the character '|' indicates the time prior to the change, and the character '{' indicates the new time.
FILES
/var/run/utmp The utmp file.
/var/log/wtmp The wtmp file.
/var/log/lastlog The lastlog file.
SEE ALSO
last(1), login(1), w(1), who(1), utmpx(5), ac(8), init(8), lastlogin(8), newsyslog(8)
HISTORY
A utmp and wtmp file format appeared in Version 6 AT&T UNIX. The lastlog file format appeared in 3.0BSD.
BSD
May 14, 2003 BSD