![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| formatting the output | ragavhere | Shell Programming and Scripting | 1 | 08-11-2008 10:03 PM |
| Formatting bdf output | Cameron | Shell Programming and Scripting | 5 | 04-09-2008 09:05 AM |
| formatting output | balaji_prk | Shell Programming and Scripting | 4 | 09-15-2007 09:23 AM |
| Formatting output | illur81 | Shell Programming and Scripting | 3 | 10-13-2005 09:24 AM |
| Formatting the output | Cameron | Shell Programming and Scripting | 7 | 02-15-2002 10:30 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
[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 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|