My code is something like below.
=============
But echo $i output comes like
is there a way I can get output of awk from for loop in straight line. so I can export ORACLE_SID and Username without redirect to file of executing:
Thanks for Help in advance.
Moderator's Comments:
Refusing to properly format sample input, sample output, and code segments after five warnings has resulted in this account being made read-only for three days.
Continued refusal to properly format posts may result in being banned from ever posting again.
Last edited by Don Cragun; 02-10-2016 at 10:54 PM..
Reason: Add CODE and ICODE tags.
Untested, but might come close:
However, if the script you showed us produces the output you showed us, it means that $1 or $8 in the script expands to an empty field (and I would assume that it would be the 8th field that is empty.
The code above assumes that you know that the 1st and 8th fields contain the data you want and that the code you showed us is not exactly what you ran. If that assumption is not correct, we need to see the output produces by ps -ef and we need to know what output you are hoping to extract as a result of running your script. Since line is never set in the script you showed us, the USERNAME and ORACLE_SID shell variables script are probably being set to empty strings (unless line is set to some non-empty string in the environment inherited by your script).
The behavior of awk can also vary from system to system. Please also tell us what operating system you're using so we can better understand what you're trying to do.
With all those exclusions, is "pmon" the right thing to match? And, as the first field in ps's IS the (already known and matched for?) username, do you really need to obtain it from your script?
Hi,
I am trying to print copy percentage completion dynamically by using the script below,
#!/bin/bash
dest_size=0
orig_size=`du -sk $sourcefile | awk '{print $1}'`
while ; do
dest_size=`du -sk $destfile | awk '{print $1}'`
coyp_percentage=`echo "scale=2; $dest_size*100/$orig_size"... (4 Replies)
example of problem:
when I echo "$e" >> /home/cogiz/file.txt
result prints to file as:AA
BB
CC
I need it to save to file as this:AA BB CC
I know it's probably something really simple but any help would be greatly appreciated.
Thank You.
Cogiz (7 Replies)
Hello,
I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it.
I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Hello.
I have been looking high and low for the solution for this. I seems there should be a simple answer, but alas.
I have a big xml file, and I need to extract certain information from specific items. The information I need can be found between a specific set of tags. let's call them... (2 Replies)
Hi,
This is my input file
cat input
chr1:100-200
chr1:220-300
chr1:300-400
Now, I would like to run a program that will take each of the input record
for i in `cat input`; do program $i | wc -l;done
the output will be something like
10
20
30
But, I would like to print the... (4 Replies)
Hi ,
i want to print the output in line by line
while read LINE
do
echo $LINE | grep UCM | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRBr | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRP| egrep '(Shutdown|Unavailable)'
echo $LINE | grep OM | grep JMS|... (7 Replies)
Hi All,
I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file.
Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Hi,
Need awk help to group and print lines to format the output as shown below
INPUT FORMAT
set echo on
set heading on
set spool on
/* SCHEMA1 */ CREATE TABLE T1;
/* SCHEMA1 */ CREATE TABLE T2;
/* SCHEMA1 */ CREATE TABLE T3;
/* SCHEMA1 */ CREATE TABLE T4;
/* SCHEMA1 */ CREATE TABLE T5;... (5 Replies)