Your for loop copies the file you cat'ed output of 'file', defines the variable file by greping file (which you already cat'ed), and then copy file (which you cat'ed) as many times as entries are found in file (which you cat'ed) to test, overwrite 'test' as many times as entries were found.
Then you execute 3 files..
1) the file you cat'ed
2) and /tmp/[unix)$(date +y)log
Assuming /some/file holds a list of diffrent files....
Now it sets the variable workfile to the content of the result of grep'ing key out of $ENTRY, and then copies the $workfile to the current path test.$ENTRY, where $ENTRY is the filename (if the (some/file contains other filenames/paths) of the file you grep'ed ALL lines containing the word 'key' in it.
At least it doesnt overwrite the file 'test' a dozen times anymore...
Can you elaborate a bit more of what you'd like to achieve?
For example with the logfiles and by the call of the 'file'?
EDIT:
Been late, of course, if test is a directory, all files are copied there.
Hi,
I have a Report.txt file. Say the contents of this file are :
1 2 3 4 5 7 df v g gf
e r dfkf lsdk dslsdklsdk
Report Start: xxxxxxdad
asdffsdfsdfsdfasfasdffasdf
sadfasdfsadffsfsdf Report End.
sdfasdfasdf
sdfasfdasdfasdfasdfasdf
sadfasdfsdf
I need to grab from Report Start... (3 Replies)
Here is another script I am trying to customize currently,
this script is used to send me disk space information, but at the moment I have to enter all the servers in manually SERVER= "xxx bbb ccc" ect..
how can I script it so that the servers are called off a txt file versus me entering all... (1 Reply)
I have a script right now that I run a command which outputs just one word to a file. Well I need to grab that value and use it in another line of code so...
touch oraclesid.txt
echo $ORACLE_SID > oraclesid.txt
#grab that value
sqlplus v500/v500@<value>
how do I grab that value from the... (6 Replies)
Hi all,
Very new to shell scripting so appreciate some help!
There is a process count that I need to monitor, I have the AIX command that gives this value and I've cleaned it up with grep/awk so it only spits out the value I'm interested in:
echo "psc -i 10050 -s RELOAD_SERVICE" | tmadmin... (14 Replies)
Hi,
I have this problem where sometimes my files would go missing when I schedule my crontab to run the SCP command to get file from the SFTP server.
My crontab will run the scripts at an interval of 3 minutes (between the two scripts) The following is the setting in my crontab.
... (1 Reply)
I am executing a stored proc and sending the results in a log file. I then want to grab one result from the output parameters (bolded below, 2) so that I can store it in a variable which will then be called in another script. There are more details that get printed in the beginning of the log file,... (3 Replies)
Hi guys,
Is there a way a script can run an SQL statement and dump the results into a variable which can then be used later in the script?
Thanks. (3 Replies)
how do I write a script to checkout a file in cvs and cat the file into a file in my home directory
Commands are
cd /home/smr/sandbox
cvsroot
choose option 1
cvs co filename
cat filename > /home/smr/newfilename
Thank you! (4 Replies)