Don't use a comma as an ouput field separator, try "|"
Because your heading shows 4 fields, yet your output, based on the use of the "," shows more. This implies a "," is in the data.
Hi
This did not seem to help with issue 1 or 2.
thanks
---------- Post updated at 05:51 PM ---------- Previous update was at 10:44 AM ----------
It seems I am making some progress...Then again I can never be sure.
I found a some sed syntax that will delete white spaces from the output.
I seem to be making progress, as the data shows up in rows on excel now. The server name also shows up where I want it. However, only part of the data is loading to excel and olny a few rows have the server name in the output. the code im using is
I'm considering to use sed to simply replace NAME with servername, NAME.
however that would give me an extra comma that I would not know what to do with.
If any one knows how to do this please post a response.
I dont need all the output. I am interested in capturing only 3 pieces of information, which are NAME,VERSION, and BASEDIR. Im my limited understanding, all these three pieces of information would make up a record.
The goal is to insert the server name in front of every record and dump the data into a comma seperated file. Once we have all the data from all our servers will will combine them into an excel spread sheet(comman delimited) for review. An example of the desired output is as follows:
so far I have been able to insert the commas with the following script:
which produces the following output...
I have discovered that a carriage return may be needed.
at this point I seem to be stuck. I was able to insert the server name
but only for a few records. For some reason it will insert the server neame every 40th record. The code I was using to do this is:
Any assistance would be greatly appreciated.
on a side not, are there any books i should be reading for scripting?
Try something like:
Note that you can't have a comma in a field in a comma separated file unless the fields that contain commas in the data are quoted. This script quotes the NAME and VERSION fields since it seems doubtful that the hostname and BASEDIR fields will ever contain commas. (Or, if they do, it should be obvious how to add the quotes if they are needed for those fields.) For the input shown, you should get something like the following from the above script:
Try something like:
Note that you can't have a comma in a field in a comma separated file unless the fields that contain commas in the data are quoted. This script quotes the NAME and VERSION fields since it seems doubtful that the hostname and BASEDIR fields will ever contain commas. (Or, if they do, it should be obvious how to add the quotes if they are needed for those fields.) For the input shown, you should get something like the following from the above script:
The script you provide looks really good. the only problem is that the host name does not seem to be coming out.
any chance we can get the host name at the begining?
---------- Post updated at 11:03 AM ---------- Previous update was at 07:05 AM ----------
Hi
Don, This issue has been resolved. is it possible you can explain your code? It would be a great help to me. Also are there any books you recomend I read? or did you get your understanding of scripting from experience?
to resolve my issue, I added the following to your code.
so the final code looks like this:
I commented out the host portion as it did not seem to work for me.
Sorry, I forgot that /bin/sh on Solaris systems is an old Bourne shell that doesn't recognize the $(command) form of command substitution. Please insert the following as the 1st line in the script I gave you:
and remove all of the other changes you made.
Aternatively, change the line:
to:
and remove all of the other changes you made.
I learned how to use UNIX system utilities and libraries by reading the manuals from cover to cover. (Unfortunately, most systems don't have paper manuals anymore, but you can still find the directories that contain the manual pages for your system and use the man utility to read what is available on your system. I would suggest starting with the commands:
When you look at code in The UNIX and Linux Forums and don't understand what it is doing, look up the man page for that utility. (You may notice that utilities on some systems support options that the utilities on Solaris systems do not support and that some utilities on Solaris systems support options that are not supported on other systems. You may also notice that some utilities only appear on Solaris systems and some utilities that are available on other systems are not available on Solaris systems. This is why it is important to always tell us what operating system and shell you're using when you post questions here.)
Hi All,
Please can you help with the output whole line for each host (column 3) and the top line of column 9 - the lastest only
What is being outputted
243272484 3 nbmedln1p03 LDN_TEST_UX_JM 1488198368 0000000007 1 INC_1MTH 0 **********
243272492 3 nbmedln1p03 LDN_TEST_UX_JM... (10 Replies)
Hello All,
I am using Linux OS. My idea is get the host name when we do tnsping in oracle.
output of : tnsping DOELO01
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 15-OCT-2015 20:20:05
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:... (2 Replies)
hello All. I am working on something that should be really simply.
It turns out that its not. I am trying to produce output to list the hostname along with all the current running programs.
the script im using is:
for PS in `ps -Ao "user,args" | cut -d' ' -f1,2`
do
echo "`uname -n`, $PS"... (5 Replies)
Got a feeling someone has been fiddling around or something has got corrupt but I'm getting the following errors now:-
-bash-3.00# pkginfo
ld.so.1: pkginfo: fatal: libssl.so.0.9.7: open failed: No such file or directory
Killed
-bash-3.00#
and also ssh:-
-bash-3.00# ssh
ld.so.1: ssh:... (5 Replies)
Hi guys.
i need some help, i need to create a script in tcsh that rsh into all my hosts that we have at our business, then cd to a directory (cd /apps/users) then grab a file from the users folder and ftp it back to my windows machine. can someone please help?
Kind regards.
Brian Behrens (2 Replies)
im looking for a way to eliminate the packages from SUN when i do a pkginfo. thought this would work, but no luck.
pkginfo | grep
what am i doing wrong?
Thanks (2 Replies)
can anyone explain me the difference between pkginfo and pkgchk command in solaris. Both are used to display the package details, then what is the difference between both. (5 Replies)
Our group has recently inherited 15 servers that have not been maintained for over a year.
My first action is to backup the units however there is not enough disk space on most of them to run tar. My supervisor said to look at piping the tar output to another machine, however I have been unable... (3 Replies)
I have a Solaris 2.6 box flagging an "Error block: 308918" in the messages file when I execute a pkginfo -l. pkginfo with no flags returns no errors. I think I need to use format to mark this block and then restore the database used by pkginfo for backup. Any advice/input welcome.
Thanks (4 Replies)