Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Script for time stamp update.

scmuser created the topic: Script for time stamp update.

write a batch Script for time stamp update?

sgadmin replied the topic: Re:Script for time stamp update.

[code language=”css”]
data=data.txt
tfile=`cat data.txt |wc -l`

[/code]

for (( i = 2 ; i <= tfile ; i++ ))
do

mfile=`cat $data |head -$i|tail -1|tr -s ” ” ” ” |cut -f8 -d” “`
mdate=`grep -i $mfile $data|tr -s ” ” ” “|cut -f6,7 -d” “`
myy=`echo $mdate |cut -b 1-4`
mon=`echo $mdate |cut -b 6-7`
mdd=`echo $mdate |cut -b 9-10`
mhh=`echo $mdate |cut -b 12-13`
mmin=`echo $mdate |cut -b 15-16`
mresult=`echo $myy$mon$mdd$mhh$mmin`
touch -t $mresult $mfile

done

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x