Sponsored Content
Top Forums UNIX for Dummies Questions & Answers scripting help with touch and sed Post 62359 by alexkav on Tuesday 15th of February 2005 10:42:40 AM
Old 02-15-2005
gjduff, you still there? I'm trying to make the script check every 10 seconds for a new file then update a logfile. Can you see what I'm missing?

Thanks,
alexkav

#!/bin/ksh

LOGFILE=logs/gfiupload.log
NEW=`find . -type f -name "G*" -newer newtime`

while true; do
if
[ -z $NEW ]; then
echo "bombing..." >>$LOGFILE
touch newtime
sleep 10

else
FILE=`echo $NEW | sed -e 's/G//g'`
echo `date +%m%d%Y_%H:%M`: New file found: $FILE >>$LOGFILE
mv newtime oldtime
touch newtime
fi
sleep 10
done
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help on SED AWK in shell scripting

Hi, I have a script abc.sql which contains a word 'timestamp'. I have another script xyz.txt genrated everyweek, which has a new timestamp value every week. How do I replace the word 'timestamp' in script abc.sql with the value mentioned in the script xyz.txt, so that I can run the script... (3 Replies)
Discussion started by: kaushys
3 Replies

2. Shell Programming and Scripting

scripting with awk and sed

hey all, i was just wondering if it was possible to to get data from user input , and parse it through sed to remove or add what that user has entered into a flat file? do i need awk ? any help is greatly appreciated ~shan2on (2 Replies)
Discussion started by: shan2on
2 Replies

3. Shell Programming and Scripting

SED scripting select

Say I have a file 'example.txt' with these lines of code in it: hello:anddasd:cheese:gerg whatever:sdadsa:asdfasdfa:wwew hmmmm:something:gfhfhgf:sdasdas Question: 1. How would I write a script which is able to take all the words before the first ':'? 2. How would I write a script which is... (6 Replies)
Discussion started by: i_am_a_robot
6 Replies

4. UNIX for Dummies Questions & Answers

Touch all files and subdirectories (recursive touch)

I have a folder with many subdirectories and i need to set the modified date to today for everything in it. Please help, thanks! I tried something i found online, find . -print0 | xargs -r0 touch but I got the error: xargs: illegal option -- r (5 Replies)
Discussion started by: glev2005
5 Replies

5. Shell Programming and Scripting

sed scripting help need

hi all, i want to display output of sar, whichever idle time is less than 30%..i want to add HI and BYE at the starting and ending of the line. For an example: sar Linux 2.6.9-78.0.1.ELsmp (hostname) 07/10/2009 07:10:01 AM CPU %user %nice %system %iowait %idle... (7 Replies)
Discussion started by: raghur77
7 Replies

6. Shell Programming and Scripting

Shell Scripting -- sed

Hi, In one of my scripts, I am using sed to do an expression replacement. The code in the script is as under sed "s|MY_INP_Lab=""|MY_INP_Lab="${2}"|" file1, where $2=xyz_abc_mbk The EXPECTED output is in file1, all the instances ofMY_INP_Lab="" shall be replaced by... (2 Replies)
Discussion started by: vivekmattar
2 Replies

7. Shell Programming and Scripting

Sed scripting issue

Hi all! I was wondering if anyone could help suggest some solutions to an issue i'm having using the Sed command. I'm still a relative novice at this, but slowly learning and enjoying the power of batch processing. I am using Sed to extract values from a .txt file containing hundreds of... (2 Replies)
Discussion started by: StudentFitz
2 Replies

8. Shell Programming and Scripting

Need help with sed scripting

Hi expert, i need URGENT help in bash shell scripting using sed: i woud like to search for the word XMLRPC which is at theend of the line below in up2date file. Once found or match serverURL=https://redhat.com/XMLRPC replace with myserver.com like this ... (1 Reply)
Discussion started by: lamoul
1 Replies

9. Shell Programming and Scripting

Need help with awk and sed scripting

I need help with sed and awk scripts to search for Symmetrix ID=000090009902 and then grep its child disk devices associated to the dead paths and display them only, so that those dead devices can be removed. test01:/#powermt display dev=all Pseudo name=hdiskpower0 Symmetrix ID=000090009902... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

10. Shell Programming and Scripting

Help shell scripting using awk or sed or other

I need to create a script to change a file depending of 3 conditions using a target as parameter... first condition <chamada> <numeroTerminalOriginador>CALLER</numeroTerminalOriginador> <imeiOriginador></imeiOriginador> <cgiPrimeiraErbOriginador></cgiPrimeiraErbOriginador>... (2 Replies)
Discussion started by: poulis
2 Replies
touch(1B)					     SunOS/BSD Compatibility Package Commands						 touch(1B)

NAME
touch - change file access and modification times SYNOPSIS
/usr/ucb/touch [-acfm] file... DESCRIPTION
touch sets the access and modification times of each file to the current time. file is created if it does not already exist. OPTIONS
-a Change the access time of file. Do not change the modification time unless -m is also specified. -c Do not create file if it does not exist. -f Attempt to force the touch in spite of read and write permissions on file. -m Change the modification time of file. Do not change the access time unless -a is also specified. USAGE
See largefile(5) for the description of the behavior of touch when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). EXIT STATUS
The following exit values are returned: 0 touch executed successfully and all requested changes were made. >0 An error occurred. touch returns the number of files for which the times could not be successfully modified. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
touch(1), attributes(5), largefile(5) SunOS 5.10 26 Oct 1995 touch(1B)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy