473,795 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

9 New Member
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;475 93;21%;/app
May 3 '07 #1
4 4894
ghostdog74
511 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. df -m | awk '{OFS = ";"; $1=$1;print $0}'
  2.  
May 3 '07 #2
db2admin
3 New Member
Expand|Select|Wrap|Line Numbers
  1. df -m | awk '{OFS = ";"; $1=$1;print $0}'
  2.  

Does'nt work in AIX :(
May 3 '07 #3
db2admin
3 New Member
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
smashzone
9 New Member
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
2541
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 information and filename/location all stored in a database. I can't figure out how to get the result of the tail into a variable so that I can search it for an ERROR string. Any ideas? thanks in advance,
3
3723
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 gives his inputs it runs a series of commands and writes an output to a file. Once the output is producd it needs to communicate to the C++ aplication which would then need to read from this file. This whole process repeats continuously. Is there a...
1
11660
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 to create a new output files (tables with defined fields) in other 3 formats, and to fill them with data from DataSet. I created Excel output with ComponentOne's trial Excel component, but it is a temporary solution. Also I have unusual CP (1250...
1
2383
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, etc.) (If this can all be done in PHP, that'd be great.) But, how do I tell the shell script what the file name is supposed to be? Here's what I have so far: from the PHP script:
1
1750
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 wondering if this is something that could be done using JavaScript. This is a server side scripting task and JavaScript seems not to be the appropriate language for it. Any thoughts? Thank you.
2
1791
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 one please help me with a script to do so..... thanks in advance..... pradeep
7
6238
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 this shell script using the Subprocess module. Here is my code: def resultFromRunning_(command):
5
13388
by: poojaprakashsp | last post by:
ow shud i solve this problem????
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.