This sound like a school class project.
Post real data, what you have and then post example output.
Then add a good description on how you came to this output.
Eks: I have two value and like to add them together into a new variable.
This sound like a school class project.
Post real data, what you have and then post example output.
Then add a good description on how you came to this output.
Eks: I have two value and like to add them together into a new variable.
Data
Requested output
Hello,
It's not, nor a school class project nor a homework item.
I'm a scripting self-didact for my job.
It is necessary that I start at the beginning. I learn by example.
Like building a house, brick by brick, I build my script.
This is a generic script, it may be useful to other people.
In my case, I use it to retrieve a piece of log, that's why I put the following parameters: start time, end time, date etc.
Instead of the function f1, you can put your own function.
To be clearer, my function f1 is a simple echo " ". Here, the main problem is how do i do to control the parameters which i put in the input file ?
Thank you for your help.
---------- Post updated at 01:08 AM ---------- Previous update was at 12:40 AM ----------
Quote:
Originally Posted by RudiC
You're not running bash within bash to do that parameter check, are you? And you know, that single quotes within single quotes don't work?
And, I have to admit, even though I gave you the first hints on that script snippet, I'm totally lost now trying to read and understand what you are aiming for.
Would you mind to present - in plain words - what the target of your script is?
I would like my function f1 detect that in the fifth line, the first parameter is an error. And the script must return 'bad argument".
If it can return "The 1st argument in the $line is wrong" it would be better. But perhaps this is asking too much.
Alone, I turn around. With you, I learn faster.
Sorry for my broken English.
Thanks you
For the function in magenta, do you want to test arg1 (a global variable inherited from the main, not necessarily set), or $1 (the first parameter in the function call). If $1, try
Still you did not answer my question for an overall description in plain english: I can see that one of the goals is a file consisting of two comment lines, and then data lines starting with [dqpf]ora. But the several starting points, those that you are coming from, are highly obscured. Coming back to your brick laying example, it's wise to start with the fundament, but my impression from your fundament is your building will be a maze.
For the function in magenta, do you want to test arg1 (a global variable inherited from the main, not necessarily set), or $1 (the first parameter in the function call). If $1, try
Still you did not answer my question for an overall description in plain english: I can see that one of the goals is a file consisting of two comment lines, and then data lines starting with [dqpf]ora. But the several starting points, those that you are coming from, are highly obscured. Coming back to your brick laying example, it's wise to start with the fundament, but my impression from your fundament is your building will be a maze.
I want to test global variables $arg
Excuse me i have a mistake it would be 23 instead of 11
I would like to control and check the right parameters $1 must have 4 alphabetics digits among eora qora pora fora $2 must have 2 numerics digits 00 to 23 (hours) $3 must have 2 numerics digits 00 to 59 (minutes) $4 must have 10 alpha numerics and ponctuations characters as 2013-02-26
RudiC, i follow yours instructions
It's OK for the first parameter [dqpf]ora ] Can we put the line number ?
For the others parameters, i tried to test them in vain.
Again, be aware that arg n may NOT be set!
Add this to your f1 function for testing the other parameters:
Quote:
I want to test global variables $arg
Why, then, do you call f1 like you do: f1 $arg1 $arg2 $arg3 $arg4
---------- Post updated at 13:24 ---------- Previous update was at 13:06 ----------
Quote:
Can we put the line number ?
Put this into your f1 function:
and call it like
Be aware that your greping out comments will render the line no. incorrect, so you need to take action there. I guess, from the course of this thread, it will be us who need to take the action...
AND, this thread is applying band aid after band aid after band aid as you DO NOT clearly present your objectives. Planning upfront makes a good program!
Hi,
Let's say I have a control file like this:
RHEL apple "echo apple"
RHEL bravo "ls -l bravo*"
RHEL church "chmod church.txt"
SUSE drive "chown user1 drive.txt"
SUSE eagle "echo "eagle flies""
SUSE feather "ls -l feather*"
HP-UX google "sed 's/^Google.*$/&\
ACTION: go to... (14 Replies)
I'm thinking how to control and execute command to control my machine like update them,
scenario is creating a cron in machine 1 machine 2 machine 3 which download .txt file from core machine,
this txt file contain update function like:
kernel=1
yum=0
ssl=1
and store this file in... (4 Replies)
Hello,
I would like to control and check the right parameters
$1 must have 4 alphabetics digits among eora qora pora fora
$2 must have 2 numerics digits 00 to 11
$3 must have 2 numerics digits 00 to 59
$4 must have 10 characters alpha numerics as 2013-02-26
For example :
In case 5) if i... (1 Reply)
I've a list of files which got processed in Target table A and stored in a control file(list of control files).
I've want to trigger another process (later) based on this list of files and load into Target table B and continue running this process until this file list is exhuasted.
How do I come... (1 Reply)
Hi,
On a unix/linux server, how do I check if Autosys or Control-M (scheduler) is running? are there unique processes for these applications that I could do
ps -ef | grep ???
thanks,
Jason (11 Replies)
I have 2 and three params, both I should make sure thay numbers at one single line insted of checking for each one .
Example I wroote the following way.. checking for 2 and three seperately but I shud be able to do it at on statement
echo $2 | egrep '^+$' >/dev/null 2>&1
if ; then
echo... (2 Replies)
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
I'm in a fustrating situation where I am repeatidly checking code, editing,
synchronizing, finding something is broke, reverting all my changes and starting over. This if often easier than trying to merge my changes with someone who has beat me to the checkin.
Is there a way I can mitigate... (5 Replies)
Hello everybody!
I woul quickly need a function
bool ParseIPString(char*)
that parses a string to check if it's in IP format.
thanks in advance for any help!
best regards,
nadiamihu (1 Reply)
I need to get a section of a file based on 2 params. I want the part of the file between param 1 & 2. I have tried a bunch of ways and just can't seem to get it right. Can someone please help me out.....its much appreciated. Here is what I have found that looks like what I want....but doesn't... (12 Replies)