01-13-2016
Any attempts from your side?
10 More Discussions You Might Find Interesting
1. Tips and Tutorials
The GNU date command in full of goodies but not when it comes to calculate a date or time difference. Here is what I came up with after looking to more than one solution.
Code should be self explaining.
#!/bin/bash
date2stamp () {
date --utc --date "$1" +%s
}
stamp2date (){
... (0 Replies)
Discussion started by: ripat
0 Replies
2. Shell Programming and Scripting
Ok, i've been messing around in debian the past few days, setting up programs like subversion, mysql and logrotate. The purpose of this script is to use subversion to backup the binary logs. It runs in the cron every 2 hours or so (although I can't get my script to run properly atm, which is why... (1 Reply)
Discussion started by: cganly
1 Replies
3. Homework & Coursework Questions
1. The problem statement, all variables and given/known data:
I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format .
I have developed a log analysis command line utility that displays... (1 Reply)
Discussion started by: TariqYousaf
1 Replies
4. Shell Programming and Scripting
I just put together a script for work that will essentially automate the migration of our Windows fileserver to my newly created Debian based SAMBA server.
My script will create the necessary directories then copy the data over to my new server, after that it will set the ACL's by using... (3 Replies)
Discussion started by: binary-ninja
3 Replies
5. Shell Programming and Scripting
Hi,
How can I add up a series of string like:
and get a total as hour and minutes in a format like this: (3 Replies)
Discussion started by: bashily
3 Replies
6. Shell Programming and Scripting
Hi all,
I need a script to do some date/time conversion. It should take as an input a particular time. It should then generates a series of offsets, in both hour:minute form and number of milliseconds elapsed.
For 03:00, for example, it should give back 04:02:07 (3727000ms*) 05:04:14... (2 Replies)
Discussion started by: emdan
2 Replies
7. Shell Programming and Scripting
I'm looking for a way to have the "date" command output the date in a specific format.
I'm not familiar with the different ways to use the date command at all. i read up on it, but i dont get how to manipulate it.
i know that i can get the date format to give me a format like:
2012-10-13... (6 Replies)
Discussion started by: SkySmart
6 Replies
8. Shell Programming and Scripting
There is a closed Thread: <url>Here will be the url to the original post once I have 5 posts in this forum...</url>
But a small bug had found his way into this very cool and simple code.
#!/bin/bash date2stamp () { date --utc --date "$1" +%s } stamp2date (){ date --utc --date... (2 Replies)
Discussion started by: frood
2 Replies
9. Shell Programming and Scripting
i have file 1.txt
asdas|csada|13|03|10|04|23|A1|canberra
sdasd|sfdsf|13|04|26|23|28|A1|sydney
i want to add today's date and time in the end of each row
expected output
asdas|csada|13|03|10|04|23|A1|canberra|130430|1358
sdasd|sfdsf|13|04|26|23|28|A1|sydney|130430|1358
todays date... (10 Replies)
Discussion started by: radius
10 Replies
10. Programming
Dear all,
I am kindly seeking assistance on the following issue.
I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file
5.00000 15.5030
5.05000 15.6680
5.10000 16.0100
5.15000 16.3450
5.20000 16.7120
5.25000... (4 Replies)
Discussion started by: malandisa
4 Replies
READ(2) Linux Programmer's Manual READ(2)
NAME
read - read from a file descriptor
SYNOPSIS
#include <unistd.h>
ssize_t read(int fd, void *buf, size_t count);
DESCRIPTION
read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf.
If count is zero, read() returns zero and has no other results. If count is greater than SSIZE_MAX, the result is unspecified.
RETURN VALUE
On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. It is not
an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually avail-
able right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or because read()
was interrupted by a signal. On error, -1 is returned, and errno is set appropriately. In this case it is left unspecified whether the
file position (if any) changes.
ERRORS
EINTR The call was interrupted by a signal before any data was read.
EAGAIN Non-blocking I/O has been selected using O_NONBLOCK and no data was immediately available for reading.
EIO I/O error. This will happen for example when the process is in a background process group, tries to read from its controlling tty,
and either it is ignoring or blocking SIGTTIN or its process group is orphaned. It may also occur when there is a low-level I/O
error while reading from a disk or tape.
EISDIR fd refers to a directory.
EBADF fd is not a valid file descriptor or is not open for reading.
EINVAL fd is attached to an object which is unsuitable for reading.
EFAULT buf is outside your accessible address space.
Other errors may occur, depending on the object connected to fd. POSIX allows a read that is interrupted after reading some data to return
-1 (with errno set to EINTR) or to return the number of bytes already read.
CONFORMING TO
SVr4, SVID, AT&T, POSIX, X/OPEN, BSD 4.3
RESTRICTIONS
On NFS file systems, reading small amounts of data will only update the time stamp the first time, subsequent calls may not do so. This is
caused by client side attribute caching, because most if not all NFS clients leave atime updates to the server and client side reads satis-
fied from the client's cache will not cause atime updates on the server as there are no server side reads. UNIX semantics can be obtained
by disabling client side attribute caching, but in most situations this will substantially increase server load and decrease performance.
Many filesystems and disks were considered to be fast enough that the implementation of O_NONBLOCK was deemed unneccesary. So, O_NONBLOCK
may not be available on files and/or disks.
SEE ALSO
close(2), fcntl(2), ioctl(2), lseek(2), readdir(2), readlink(2), select(2), write(2), fread(3), readv(3)
Linux 2.0.32 1997-07-12 READ(2)