Sponsored Content
Full Discussion: CENTOS - istat
Operating Systems Linux Red Hat CENTOS - istat Post 302925364 by ongoto on Sunday 16th of November 2014 09:05:35 PM
Old 11-16-2014
Good job derekludwig. Smilie

Not trying to one up you, but, since I already went to the trouble...

Here's the OPs script modified to work with bash (Centos standard I think).
Code:
#!/bin/bash

HOUR=0
MONTHN=0
[ -f $2 ] || touch $2
[ -f $3 ] || touch $3

if [ -f $1 ]
then
    :
else
    echo 99999999 > $2
    exit
fi

# LINE=`istat $1  | grep modified`

# LINE2=`istat $1 | grep Owner` 
 LINE=`ls -l --time-style='+%Y %m %d %H:%M' | grep $1`

# MONTH=`echo  $LINE | awk '{ print $4 }'`
YEAR=`echo  $LINE | awk '{ print $6 }'`
MONTHN=`echo  $LINE | awk '{ print $7 }'`
DAY=`echo  $LINE | awk '{ print $8 }'`
HOUR=`echo $LINE | awk '{ print $9 }'`
P1=`echo $LINE | awk '{print $1}'`

HOUR=`echo $HOUR | sed "s/://g"`

# for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
# do
#     # MONTHN=`expr $MONTHN \+ 1`
#     if [ "$MONTH" = "$i" ]
#     then
#         break
#     fi
# done

# MONTHN=`expr $MONTHN \+ 100 | cut -c2-4`
echo $YEAR$MONTHN$DAY$HOUR > $2

USER=`echo $LINE | awk '{ print $3 }'`
echo $USER > $3

# eof #

output
Code:
$ ls -l --time-style='+%Y %m %d %H:%M' | grep istat.sh
-rwxr-xr-x. 1 owner group  833 2014 11 16 17:58 istat.sh*
$ istat.sh targetfile mtimefile ownerfile
201411151034 > mtimefile
owner > ownerfile

I'm wondering about the usefulness of this meager output though???

Last edited by ongoto; 11-16-2014 at 11:52 PM.. Reason: fat thumb fixes & added output
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

HP LC2000 has message: istat=0a: LSS_PAR on ha=1 sist0=41

I have a HP Netserver 2000 running SCO UNIX 5.0.6. I get the message: istat=0a: LSS_PAR on ha=1 sist0=41 sist1=00 !!!! dstat =81 on ha=1 has DS_OPC while WAIT DISCONNECT, rp=c014f8co dsp=FD on path=1, newdsp=FD064600 WARNING: Parity Error MSG OUT=00000006 Failed, 1code=80000002 on ha=1 id... (0 Replies)
Discussion started by: dmksh
0 Replies

2. UNIX for Advanced & Expert Users

istat ??

I got the command : istat filename shows all the file details like owner and group name. But i want to know, who has accessed the file last time. As istat shows the name of owner of that file and name of the group. istat does lots of my work but i want to know who has accessed my file... (0 Replies)
Discussion started by: varungupta
0 Replies

3. UNIX for Advanced & Expert Users

istat ??

I got the command : istat filename shows all the file details like owner and group name. But i want to know, who has accessed the file last time. As istat shows the name of owner of that file and name of the group. istat does lots of my work but i want to know who has accessed my file... (2 Replies)
Discussion started by: varungupta
2 Replies

4. Shell Programming and Scripting

reformat date from istat

I would like to determine if a file is older than a particular date. I found that istat will let me see the date and time of a file older than a year, but I need to change the format. Could anyone help me reformat the following date to a variable (a one liner would be great). Output from istat -... (1 Reply)
Discussion started by: oldman2
1 Replies

5. Red Hat

How to Upgrade Centos 5.7 using Centos 5.8 ISO image on Vmware workstation

Dear Linux Experts, On my windows 7 desktop with the help of Vmware workstation (Version 7.1), created virtual machine and installed Centos 5.7 successfully using ISO image. Query : Is this possible to upgrade the Centos 5.7 using Centos 5.8 ISO image to Centos version 5.8?.. if yes kindly... (2 Replies)
Discussion started by: Ananthcn
2 Replies

6. Red Hat

RH V Centos

Hi, I have built out a new virtual production environment (VMWare, HA enabled, VMotion... all the bells & whistles) using RHEL5 VM's. I have got another ESX host that I plan to use as a pre-prod environment. To save some costs on RH subs I was thinking about installing this environment... (5 Replies)
Discussion started by: Duffs22
5 Replies
echo(1B)					     SunOS/BSD Compatibility Package Commands						  echo(1B)

NAME
echo - echo arguments to standard output SYNOPSIS
/usr/ucb/echo [-n] [argument] DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output. echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi- ronment variables. For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows: o echo your current-working-directory's full pathname o pipe the output through tr to translate the path's embedded slash-characters into space-characters o pipe that output through wc -w for a count of the names in your path. example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w" See tr(1) and wc(1) for their functionality. The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's echo() also understands a as the audible bell character; however, these commands do not have an -n option. OPTIONS
-n Do not add the NEWLINE to the output. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5) NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases. SunOS 5.10 3 Aug 1994 echo(1B)
All times are GMT -4. The time now is 06:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy