Sponsored Content
Full Discussion: [SHELL] Output formatting
Top Forums Shell Programming and Scripting [SHELL] Output formatting Post 302237972 by Adrnalnrsh on Thursday 18th of September 2008 07:49:13 PM
Old 09-18-2008
[SHELL] Output formatting

I am looking for a way to format the output of this string into comma separated values (.csv) so I can import into excel.

Also I want to remove any white space generated by the commands, particularly the dmidecode as the output has lots of space in front of Serial Number.

Code:
#!/bin/bash

for i in $( cat "ipaddresses.txt" ); do     # list of ip addresses 
echo "$i" >> host_details.txt;
ssh $i 'hostname ; dmidecode | grep "Serial Number" | head -1 ; free -m | grep Mem | awk '\''{ print $1,$2 }'\'' ; uname -r ; ' >> host_details.txt
done



Current output looks like.


[root@server user]# cat test23.txt
server.domain.com
-WHITE SPACE--Serial Number: F3FF071
Mem: 2007
2.4.21-27.ELsmp
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

formatting output

Hi need some advice.. #grep -i hostname test.csv (gives the below output) HOSTNAME,name,host_test,,,,,,,, Now I need to format the above output as below. HOSTNAME: name=host_test Any easy way of doing this using awk or sed or printf? (4 Replies)
Discussion started by: balaji_prk
4 Replies

2. Shell Programming and Scripting

Output Formatting

Hi Guys I need help removing some lines from output i am receiving from a shell script. Here is the output: http://i52.tinypic.com/10z0fut.png I am trying to remove the output that i have circled. . ${EDW}/extracts/bin/extracts_setup2.sh . ${EDW}/extracts/extracts.conf ... (7 Replies)
Discussion started by: mooey1232003
7 Replies

3. Shell Programming and Scripting

Formatting the query output using shell script

Hi All, I'm finding it difficult to format the query output that was returned in a shell script. Actually i have one shell script which does some DB stuff and depending on the result it will do some more tasks. My question here is to format the query output returned by mysql. Intitally my... (5 Replies)
Discussion started by: RSC1985
5 Replies

4. Shell Programming and Scripting

sql select command output formatting in shell script

Hi, I need to connect to the database and retrieve two variables from the database and store them in a variable,out of these two variables I need to get lastdigit appended to the variable 1 retrieved and variable 2 with out any modification in short select var,data from usage; o/p=... (1 Reply)
Discussion started by: rkrish
1 Replies

5. Shell Programming and Scripting

Problem in formatting output of SQL query in excel sheet in shell script

Hi Guys.. Need your help to format the output of my shell script. I am using spool command to take out put in csv file. below is my code. (for example) col USERNAME for a15 col EMAIL for a30 col FULL_NAME for a20 col LAST_LOGIN for a40 col DATE_CREATED for a40 SPOOL 120.csv... (3 Replies)
Discussion started by: Agupte
3 Replies

6. Shell Programming and Scripting

Formatting the output

Hi, I have a file which contents entries in this form. Only in /data4/temp abc.000001 Only in /data4/temp abc.000003 Only in /data4/temp abc.000012 Only in /data4/temp abc.000120 Only in /data4/temp abc.000133 Only in /data4/temp abc.001444 i want to read line by line and format... (2 Replies)
Discussion started by: arijitsaha
2 Replies

7. Shell Programming and Scripting

Formatting Shell script output to Excel

I am facing a problem formatting the output of my shell script in excel. We are directing the output of the script to an excel sheet and need long integer type data printed in Excel as it is (i.e. not in the default scientific notation). Also, leading zeroes(if any) in the output are getting... (4 Replies)
Discussion started by: bornali.p
4 Replies

8. AIX

Help Formatting Output

I am using FORTRAN 90 on AIX 5.3 and need to output my data to a tab-delimited file. It must have actual tabs, and I cannot figure out a way to make it work. The resulting file will be imported into another application (quickbooks) as an .iif file....for some reason, it needs the tabs; spaces do... (2 Replies)
Discussion started by: KathyB148
2 Replies

9. Shell Programming and Scripting

Formatting output

I have the output like below: DEV#: 9 DEVICE NAME: hdisk9 TYPE: 1750500 ALGORITHM: Load Balance SERIAL: 68173531021 ========================================================================== Path# Adapter/Path Name State Mode Select Errors 0 ... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

10. Shell Programming and Scripting

SQL Query in Shell Script output formatting

Hi All, #!/bin/ksh call_sql () { sql=$1 sqlplus -s $sqlparam_sieb <<EOF SET ECHO OFF; SET NEWPAGE NONE; SET SQLBL OFF; SET VERIFY OFF; SET LINESIZE 2000; SET... (2 Replies)
Discussion started by: Kevin Tivoli
2 Replies
isympy(1)																 isympy(1)

NAME
isympy - interactive shell for SymPy SYNOPSIS
isympy [-c | --console] isympy [ {-h | --help} | {-v | --version} ] DESCRIPTION
isympy is a Python shell for SymPy. It is just a normal python shell (ipython shell if you have the ipython package installed) that exe- cutes the following commands so that you don't have to: >>> from __future__ import division >>> from sympy import * >>> x, y, z = symbols("xyz") >>> k, m, n = symbols("kmn", integer=True) So starting isympy is equivalent to starting python (or ipython) and executing the above commands by hand. It is intended for easy and quick experimentation with SymPy. For more complicated programs, it is recommended to write a script and import things explicitly (using the "from sympy import sin, log, Symbol, ..." idiom). OPTIONS
-c shell, --console=shell Use the specified shell (python or ipython) as console backend instead of the default one (ipython if present or python otherwise). Example: isympy -c python FILES
${HOME}/.sympy-history Saves the history of commands when using the python shell as backend. BUGS
The upstreams BTS can be found at <http://code.google.com/p/sympy/issues/list> Please report all bugs that you find in there, this will help improve the overall quality of SymPy. SEE ALSO
ipython(1), python(1) 2007-10-8 isympy(1)
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy