I'm not sure what you mean by include files? Please excuse my ignorance.
@Don -
I like that approach much better as there will be people other than myself interacting with this process so the less headaches the better for me as I'm sure folks would be confused by that 'ghost' process.
Here is what I arrived on :
Working as expected - thank you again for all your help!
---------- Post updated at 07:42 AM ---------- Previous update was at 07:38 AM ----------
Quote:
Originally Posted by hicksd8
I appreciate that I'm coming to this thread very late but, having read it a few times, isn't there a better way than dynamically editing a script (or whatever you want to call it)?
If the 3 lines are always the same code (ie, they don't contain moving date information or anything like that) why can't you have two copies (different files) of the script, one for weekdays and one for Sundays? Then test for day of week at start of script and run the weekday or Sunday script as appropriate. Even if the file has to be a certain name you could rename files before execution on a Sunday and rename them back on completion.
Or have I completely missed some point here???
I understand your train of thought here, however I'd prefer not to have unnecessary files out there if I can help it.
I appreciate that I'm coming to this thread very late but, having read it a few times, isn't there a better way than dynamically editing a script (or whatever you want to call it)?
If the 3 lines are always the same code (ie, they don't contain moving date information or anything like that) why can't you have two copies (different files) of the script, one for weekdays and one for Sundays? Then test for day of week at start of script and run the weekday or Sunday script as appropriate. Even if the file has to be a certain name you could rename files before execution on a Sunday and rename them back on completion.
Or have I completely missed some point here???
The reason that I don't like having a "Sunday" file and a "weekday" file is that eventually some future code maintainer is going to need to update the code and will end up updating only one of the two files when they need to be kept in sync.
Quote:
Originally Posted by SIMMS7400
Hi Rudi -
I'm not sure what you mean by include files? Please excuse my ignorance.
In the C programming language, you can use:
to include the contents of the header named header_name in your C source code at that point. In the shell, you can use:
to run the commands include in the file named file_name at that point in your script. If the language used in .mxl files has a language feature that allows you to include other .mxl files in a script, you could have Oracle_PEL.mxl include the Sunday code commands from a separate file. On Sunday, you could give it the name of the file containing .mxl code to be run on Sundays and on other days you could include /dev/null.
Quote:
@Don -
I like that approach much better as there will be people other than myself interacting with this process so the less headaches the better for me as I'm sure folks would be confused by that 'ghost' process.
Here is what I arrived on :
Working as expected - thank you again for all your help!
---------- Post updated at 07:42 AM ---------- Previous update was at 07:38 AM ----------
... ... ...
Your code is a little bit dangerous. If the Sunday portion of your script is run twice, you can end up with invalid comments that look like:
Instead of editing the actual script file, you might want to create a template file that looks like what should be run on days other than Sunday (let's call it Oracle_PEL.mxl.template) and change your code to something like:
Dear all,
i am having text file like below
surya
rama
ranga
laxman
rajesh
reddy
i want add string (OK) before a text from line 3 to 5
the result will be
surya
rama
OK ranga
OK laxman
OK rajesh
reddy (1 Reply)
Hi,
Anyone can help me in Solaris command on how to insert a file at specific line.
I want file1.sql content to be inserted on file2.sh after "recover database using backup controlfile until cancel".
# file1.sql
/archivelogs/927_822338133.arc
/archivelogs/671_822338107.arc... (3 Replies)
This could be a really dummy question.
I have a log text file.
What unix command to extract line from specific string to another specific string.
Is it something similar to?:
more +/"string" file_name
Thanks (4 Replies)
Hi I'm a beginner, and i've been having trouble joining two lines.
I need to convert this file
1097ALABAMA Mobile County METHOMYL INSE
CTICIDES 6 1.6200000E+00 1.8000001E+00
1003ALABAMA Baldwin County ... (5 Replies)
this is Korn shell unix.
The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns... (4 Replies)
So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from.
I then have to input the part... (4 Replies)
Hi,
I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this?
I tried to add it at 5th position using the below code. It didnt work. Please help!!!
awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Hi,
I am new to ksh scripting and I have a problem.
I have a file in which I have to search for a particular pattern say 'a' then from that line I need to search for another pattern say 'b' in the previous lines and thne print the file from pattern 'b' till the end of file.
For eg:
... (2 Replies)
Hi,
I need to insert two new lines in a file:
The file:
".....
......
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
....
....
"
I need to add the lines:
LD_LIBRARY_PATH='$LD_LIBRARY_PATH:$APACHE_HOME/modules'
DOWNLOADMODULE_CONF_PATHNAME='$APACHE_HOME/conf/DWLModule.cfg'
right... (2 Replies)
Hi There
I have this file that I would like to add entries to, however, there is a "}" as the last line that I need to keep. Basically i would like to know how I can write a script that will add new lines at the second to last line position (ie always add new line above the close bracket)
... (17 Replies)