I have shell file that has the following logic, i am new to shell programming.
What does process month $1 do?
I am assuming that the below dates go back three months from sysdate month. is it right :
Thanks a lot for the helpful info.
No, or maybe. It depends on the parameters that you pass to this script when you invoke it. And, of course it also depends on what locale you are using (Is "2012/03/01" March 1st or January 3rd?), what shell you are using (Process_months=$1 is a syntax error in csh and its derivatives, but sets the shell variable Process_months to the string specified by the 1st parameter passed to this script when you invoked it in a shell that uses Bourne shell syntax), and on what operating system you're using (date -d is an unknown option on some system and a means to specify a date and/or time other than the current date and time if you're using date on other operating systems).
Assuming that you are using a shell based on Bourne shell syntax, that you are using an operating system that comes with a GNU version of the date utility, and that you invoke this script with a 1st command line parameter set to 3, then the shell variable process_end will be set to a string that is the complete year number followed by the month number (as a two-digit decimal value with a leading zero if the month represented comes before October) for a date that is three months before you run this script.
Since what you have shown us gives no indication of what will be done with that variable, I have absolutely no idea whether or not that means that the script will process "dates" that "go back three months from sysdate month".
No matter what shell you are using, the test being used in the if statement:
is incorrectly specified, but (on a shell using Bourne shell syntax) will accidentally do what was wanted if no command line arguments were specified when the script was invoked. In this case the test will evaluate as true because the string -z is not an empty string while the code seems to have been written to determine whether or not the expansion of the 1st command-line parameter was an empty string which would have been correctly written as:
I hope this helps.
Below are my custom period start and end dates based on a calender, these dates are placed in a file, for each period i need to split into three weeks for each period row, example is given below.
Could you please help out to achieve solution through shell script..
File content:
... (2 Replies)
Hi,
I have a scenario where I want to display the output based on the pattern search between the start and end of a block in a file, we can have multiple start and end blocks in a file.
Example give below, we need to search between the start block abc and end block def in a file, after that... (5 Replies)
I have a file which looks something as following, I would like to split to several files, The start and end of each file is 'FILE' and end with 'ASCII... ' .
At the same time for each file in the first column add 100 and also second column add 100 the rest of the column as it is , see example of... (2 Replies)
Hi,
I have a log file (log.txt) that which contains lines of date/time.
I need to create a script to extract a CSV file (out.csv) that gets all the sequential times (with only 1 minute difference) together by stating the start time and end time of this period.
Sample log file (log.txt)
... (7 Replies)
Hi,
I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Dear Members,
Depending on the current date i should find out the start and end dates of the quarter.
ex: Today date is 14-Nov-2011 then Quarter start date should be Oct 1 2011 and Quarter End date should be Dec 31 2011.
How can i do this?
Thanks
Sandeep (1 Reply)
Hi All,
Want to get all dates and Julian week number for that date between the start date and end date. How can I achive this using perl?
(To achive above functionality, I was connecting to the database from DB server. Need to execute the same script in application server, since databse... (6 Replies)
Hi All,
I enter Start date and end date as parameters. I need to capture dates between start date and end date. Please let me know if you have any idea the same.
Thanks in advance.
Nagaraja Akkivalli. (5 Replies)
Hi All,
Requirement: remove start and end tag of parent element
<DummyLevel>
<level1> </level1>
<level2> </level2>
<level3> </level3>
<level4> </level4>
<level5> </level5>
<level6> </level7>
</DummyLevel>
I have to delete the first <dummylevel> and last </DummyLevel> tags from... (7 Replies)