473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

shell script to create an output file of a "df -m" command with ";" seperators

Hi all,

Can anyone help me with a script to produce an output file of a "df -m" command with ";" seperators. I assume its very easy but I know nothing about Linux/Unix (I'm a newbie)

That is:
df -m

[philani@slayer ~]$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/md0 9845 4881 4464 53% /
/dev/md1 62994 12201 47593 21% /app
/dev/sdb1 312 25 271 9% /boot
/dev/sda1 563166 339521 195038 64% /data
none 1005 0 1005 0% /dev/shm

The output file should contain something like this:

9845;4881;4464;53%;/
62994;12201;47593;21%;/app
May 3 '07 #1
4 4857
ghostdog74
511 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. df -m | awk '{OFS = ";"; $1=$1;print $0}'
  2.  
May 3 '07 #2
Expand|Select|Wrap|Line Numbers
  1. df -m | awk '{OFS = ";"; $1=$1;print $0}'
  2.  

Does'nt work in AIX :(
May 3 '07 #3
this worked :
df -m|tr -s " \t" ","

I was trying with
df -m|sed 's/[ \t]{1,}/,/g'
but did'nt worked,
can anybody point out as what is wrong in it ? :)
May 3 '07 #4
Thanks a lot guys...it worked
May 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: melih.onvural | last post by:
Group, I want to get into a remote server, tail a file, and see if the last line is an error or not. I think that I've figured out how to shell over and tail the file. I have the specific server...
3
by: FPGA05 | last post by:
Hello All, I am developing a small application in which I would need a C++ application to read the output from a shell script. A shell script keeps looking for user inputs and once the user...
1
by: tkaleb | last post by:
I have to create output file in a text, MS Access, MS Excel and .dbf format from C# Win/ADO.NET application. Data are collected in DataSet and there is no problem to make text file. However, I have...
1
by: news | last post by:
At the end of a PHP script, I'm sending a file via FTP to a server. I thought it'd be best to use a shell script in order to automate the FTP (logging in, changing to binary, putting the file,...
1
by: nanosuna | last post by:
Hi, I was given a task to translate a unix bourne shell script that does file renaming and string replacement on a server . I am not too familiar with the capabilites of JavaScript, so I was...
2
by: pravada | last post by:
Hi i am new to unix. just trying to work my things out. i have a small problem. i needed to search for a file that is created mostly first week of every month and email it to a list.... can some...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
5
by: poojaprakashsp | last post by:
ow shud i solve this problem????
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.