09-11-2001
Yes, even a one character write to a file without changing the file size will indeed update ctime. You can verify this with fewer keystrokes than you spent asking the question:
print -n a > x
ls -lc x
# wait a minute
print -n b > x
ls -lc x
Also the manpage for write(2) states:
Quote:
Upon successful completion, where nbyte is greator than 0, write() will mark for update the st_ctime and st_mtime fields of the file
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am currently running the following Korn shell script which works fine:
#!/usr/bin/ksh
count=`db2 -x "select count(*) from schema.tablename"`
echo "count"
I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies
2. Shell Programming and Scripting
I am testing a script and need to change the system date to Nov 30 2009. I cannot seem to find a way to do this other than TZ command but it does not seem to work correctly.
I tried TZ=GMT+168 date but it is returning todays date
Mon Dec 7 19:48:11 GMT 2009
...instead of Nov 30 2009
I... (4 Replies)
Discussion started by: hanton
4 Replies
3. Shell Programming and Scripting
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)
Discussion started by: kandi.reddy
15 Replies
4. UNIX for Dummies Questions & Answers
Hello gurus,
I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4:
NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies
5. UNIX for Dummies Questions & Answers
Hi Guys,
Anyone who knows how to compare the current date with the a file containing a date, say for example I have a file that looks like this:
Command was launched from partition 0.
------------------------------------------------
Executing command in server server6
Fri Dec 16... (7 Replies)
Discussion started by: rymnd_12345
7 Replies
6. Shell Programming and Scripting
Hi! I am trying to read a file and every line has a specific date as one of its fields.
I want to take that date and compare it to the date today plus 6 days.
while read line
do
date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD
if ; then
...proceed commands
... (1 Reply)
Discussion started by: kokoro
1 Replies
7. Shell Programming and Scripting
I get the date that's inside a text file and assigned it to a variable. When I grep the date from the file, I get this,
Not After : Jul 28 14:09:57 2017 GMT
So I only crop out the date, with this command
echo $dateFile | cut -d ':' -f 2,4The result would be
Jul 28 14:57 2017 GMT
How do I... (3 Replies)
Discussion started by: Loc
3 Replies
8. SCO
Hi! All,
I am trying to reset the date and time since the change in time over the weekend. I cannot issue the command date -t 201703131330.
The system gives me an error invalid option.
This happens on my SCO OpenServer 5.0.7 and 5.0.6. Do anyone have an idea why? I even tried using... (6 Replies)
Discussion started by: trolley
6 Replies
9. UNIX for Beginners Questions & Answers
Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt .
I don't want to delete... (2 Replies)
Discussion started by: Stuti
2 Replies
10. Answers to Frequently Asked Questions
I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update. (1 Reply)
Discussion started by: Stuti
1 Replies
LEARN ABOUT OPENSOLARIS
fwrite
fwrite(3C) Standard C Library Functions fwrite(3C)
NAME
fwrite - binary output
SYNOPSIS
#include <stdio.h>
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
DESCRIPTION
The fwrite() function writes, from the array pointed to by ptr, up to nitems elements whose size is specified by size, to the stream
pointed to by stream. For each object, size calls are made to the fputc(3C) function, taking the values (in order) from an array of
unsigned char exactly overlaying the object. The file-position indicator for the stream (if defined) is advanced by the number of bytes
successfully written. If an error occurs, the resulting value of the file-position indicator for the stream is unspecified.
The st_ctime and st_mtime fields of the file will be marked for update between the successful execution of fwrite() and the next successful
completion of a call to fflush(3C) or fclose(3C) on the same stream or a call to exit(2) or abort(3C).
RETURN VALUES
The fwrite() function returns the number of elements successfully written, which might be less than nitems if a write error is encountered.
If size or nitems is 0, fwrite() returns 0 and the state of the stream remains unchanged. Otherwise, if a write error occurs, the error
indicator for the stream is set and errno is set to indicate the error.
ERRORS
Refer to fputc(3C).
USAGE
Because of possible differences in element length and byte ordering, files written using fwrite() are application-dependent, and possibly
cannot be read using fread(3C) by a different application or by the same application on a different processor.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
write(2), fclose(3C), ferror(3C), fopen(3C), fread(3C), getc(3C), gets(3C), printf(3C), putc(3C), puts(3C), attributes(5), standards(5)
SunOS 5.11 24 Jul 2002 fwrite(3C)