It's just that I feel my question is not that complicated but yet not one seems to answer..
One of the reasons questions get answered is the are "interesting" to solve: that means usually: non-trivial, non-obvious, complicated. Its an ironic fact that questions easy to be answered might take a longer time to actually be answered than the complicated and awkward ones.
Quote:
Originally Posted by aimy
While waiting for the solution, I take my own iniative to study a bit about awk utility.
That is exactly the right approach.
Quote:
Originally Posted by aimy
So, where i do went wrong in the script to set all that awk commands as a variable?
First off, your solution with awk is about the same line as my suggestion of sed - in this regard these two tools do about the same even if they do it in a somewhat different way.
Secondly there is a subtle syntactical error in your code: a variable assignment in shell scripts must not use blanks surrounding the "="-sign. Notice the difference between the two lines:
The reason is that the shell takes everything up to the "=" to be the variables name, hence when you write "x =" you are assigning a variable named "x " (x followed by a blank) and this is probably not what you intended.
Now for the main problem with your code, which is also of syntactical nature. You do NOT want to assign a string that resembles a command to the variable but you want the output of the command be assigned instead. Therefore you must tell the shell to execute the command separately first and then assign its output. Consider the following lines:
The first line will assign the word "date" to the variable, the second one will first execute the "date"-command (whatever is between $(...) ) and execute it (in a separate shell instance, btw.). Whatever output is produced is then replacing the "$(....)" and only then the commandline is executed assigning the variable.
What does that mean to your problem? Edit the lines in the following way:
PS: some might suggest using backticks (`command`) instead of the $(command) construct. Backticks are an outdated way of basically achieving the same, but should be avoided because the newer construct is much more flexible and also better readable. It is one of the most prominent goals of shell scripting to produce code that is easily maintainable, easily read, easily understood. Backticks look in some fonts so similar to single quotes that because of this alone they should be abandoned. This being not the only disadvantage they have they should be avoided even more.
I'm having a oracle server and i'm having a table in that.
I'm having a linux server which is in network with the oracle server. I need to write a c program in linux env when on execution loads the table with the text file given as input.
Please explain me the flow of process in that and also... (6 Replies)
Hi,
I have delimited file(|).
Sample data:
1|name|50009|DS24|0|12
2|name|30009|DS24|0|13
3|name|20409|DS24|0|14
4|name|20009|DS24|0|15
5|name|10009|DS24|0|16
I want to load this data into a oracle table (update and insert)
Please help me the commands and also... (1 Reply)
I have requirement:
1) Check the record count in table (table in oracle)
2) If records exists generate the file for existing records and wait for some time (Go to sleep mode) and
Again check the record count after 10 min.......... (Loop this process if record count >0).
3) Generate touch... (1 Reply)
I have requirement:
1) Check the record count in table (table in oracle)
2) If records exists generate the file for existing records and wait for some time then Go to sleep mode and
Again check the record count after 10 min.......... (Loop this process if record count >0).
3) Generate touch... (1 Reply)
Hi
I am having three oracle databases running in three different machine. their ip address is different. from one of the DB am able to access both the databases.(means am able to select values and insert values in to tables individually.)
I need to fetch some data from DB1 table(say DB1 ip is... (2 Replies)
Hi,
I am trying to insert a record into a table (say dips_tbl) which resides in Oracle DB through a ksh script. I want to insert records into few of the table columns-not all. I'll give an e.g. for the date column "CREATE_DATE".
For that I first execute
SQL1="SELECT SYSDATE FROM DUAL"
... (1 Reply)
Hi All,
I want to insert STAT and ENDTIME values for each job in joblist into TBL_DAILY_STATUS table.
Eg: insert into tbl_daily_status values(STAT,ENDTIME);
Please help me on this.
#!/bin/ksh
joblist="com_abc_job com_abc_dot_job com_abc_seq com_abc_det"
for i in $joblist
do... (8 Replies)
hi,
i need to copy one table with data into another table,
right now am using
create table table1 as select * from table2
i want the constraints of table1 to be copied to table2 also , can anyone give me some solution to copy the constraints also, now am using oracle 10.2.0.3.0... (1 Reply)
I need to create the shell script load the few 100 table using the SQLLDR.
Need to generate the control file for each table using oracle table.
table has "table names" and "column names" using this need create the control file.
example table rows below
table_nme column_nme
DEPT ... (2 Replies)