linmatty/all
Thanks! I kinda figured out what is going on. Sometime after the creation of the msg$$ file there is an additional line of data put into it from vmstat. If I stop the program at a certain point I can see two lines of numbers. I'm not sure if that is normal for vmstat or if it...
linmatty,
It does print a header, but that header exists in the static file as well. I only get double the output from the second script (note the sections that were commented have been uncommented and instead of looking at msg.txt it is reading msg$$ which is created by vmstats).
vgersh99,
I tried the read at the end when I first put the program together and it would not read. Moving it to the beginning got it to work correctly.
I'll copy and paste your script into unix and try again.
linmatty,
I'll try yours too.
Ok, I just noticed that the file had tmp/msg*
msg* being the key here. It was reading all the msg files in tmp (which there were a few).
I reran:
while read name1 name2 name3
do
echo 'start second loop'
sed -e '1,4d' -e 's/^[ ]*//g' /tmp/msg18145 | nawk -F '[ ][ ]*' ' {printf("%d %d...
vgersh99,
the command reproduces a line of data, but I want to put parts of that line ($1, $8, $9, $14, $15, $16, $17) into variable for inserting (echoing in my example) into a table. I am anticipating having the data from 'column' 1, 'column' 8, 'column' 9, etc in variables name1, name2...
...of data on server statistics.
The last run I used this script:
while read name1 name2 name3
do
echo 'start second loop'
sed -e '1,2d' -e 's/^[ ]*//g' /tmp/msg* | nawk -F '[ ][ ]*' ' {printf("%d %d %d\n", $15, $16, $17)}'
echo $name1
echo...
...faults cpu
r b w swap free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy id
0 0 0 18288 5744 4 114 67 7 2265 0 3809 0 0 0 0 633 2656 1218 18 12 70
*note there are only three rows, the one starting with procs and the one starting with r and the one starting with 0.
linmatty,
I need the loop to do an insert into from the file to a table. That part works. :)
But this sed/awk/print/printf business is spitting out the wrong stuff.
Yeah, but this is what I get weather I use printf or print
,
devcix
memory
page
faults cpu
The spaces represent nulls but you can see what it is grabbing. It does this three times for the different lines.
,
devcix
b
w
free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy id
Then...
I'm trying to grab the value at 1, 8, 9, etc.
I'm using this script from a DBA tuning sight:
http://oracle.oreilly.com/news/unix_oracle_0101.html
This part confuses me as I am not a Unix guru. Even the way he defines it does not seem to work (as the man pages define it). The output I get...
I have a file that looks like:
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr m0 m1 m3 m4 in sy cs us sy id
0 0 0 1888 776 4 109 65 6 2277 0 3771 0 0 0 0 625 2371 1162 16 12 72
It was built from vmstat for...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.