LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2012, 12:54 AM   #1
santosh662
LQ Newbie
 
Registered: Feb 2012
Posts: 10

Rep: Reputation: Disabled
Angry doubt in adding the boarders.


hello friends,
i have written query to show the disk space usage of sum directories

below one is my script

#!/bin/ksh

CURR_DAY=`date +%m%d%Y_%H%M%S`
touch Daily1.txt
function ds

{

echo " Allocated Used Free %Used Directory" > Daily1.txt
df -h /home/vfuser | grep -iv Filesystem | grep -iv vol >> Daily1.txt
df -h /home/vfuser/review | grep -iv Filesystem | grep -iv vol >> Daily1.txt
df -h /home/vfuser/transfer | grep -iv Filesystem | grep -iv vol >> Daily1.txt

}




echo ">>>> Disk space Info">> Daily1.txt
ds

echo ">>>> Please Take Necessary Action Immediately if any of the disk space crosses more than 70% \n">>Daily1.txt
echo "--------------------------------------------------------------------------------------------------------------------------\n">> Daily1.txt

echo " Thanks & Regards, \n ">>Daily1.txt
echo " abc Operation Support \n ">>Daily1.txt

echp "--------------------------------------------------------------------------------------------------------------------------\n">>Daily.txt


cat Daily1.txt
mail -s "abc Reporting FILES ZIPPED Status On ${CURR_DAY} " abc@gmail.com < /home/vfuser/Daily1.txt

rm Daily1.txt

and the out of this is

Allocated Used Free %Used Directory
9.9G 1.8G 7.6G 20% /home/vfuser
5.0G 1.7G 3.4G 33% /home/vfuser/review
65G 49G 17G 76% /home/vfuser/transfer
>>>> Please Take Necessary Action Immediately if any of the disk space crosses more than 70% \n
--------------------------------------------------------------------------------------------------------------------------\n
Thanks & Regards, \n
abc Operation Support \n



i m trying to change in script that i want add boarders of this columns n rows.

In this i m nt getting wat changes i hav 2 do in this.

if any one knows. please suggest m that how can change in script so will get out in table

thanks advance,
santosh

Last edited by santosh662; 04-05-2012 at 12:55 AM.
 
Old 04-05-2012, 05:39 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
Adding -e to your echo commands will allow you to used escaped options to format your text.

as an example, \t will give you a tab, \n will give you a newline.

Code:
~ $ echo "no tabs no tabs not tabs"
no tabs no tabs not tabs
~ $ echo -e "with tabs\twith tabs\twith tabs"
with tabs       with tabs       with tabs
The rest can be found here: http://www.mkssoftware.com/docs/man1/echo.1.asp
 
Old 04-05-2012, 06:30 AM   #3
santosh662
LQ Newbie
 
Registered: Feb 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
HI fukawi1
i tried ur script by using -e command it was giving proper space between two columns.

but my acquirement was the out was to be displayed a proper table with proper boarders.

Thanks advance,
Santosh
 
Old 04-06-2012, 03:51 AM   #4
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
You can essentially fabricate the border in your echo commands.

Code:
echo -e "##########################################"
echo -e "#                                        #"
echo -e "# $var1\t $var2\t #"
echo -e "#                                        #"
echo -e "#                                        #"
echo -e "##########################################"
I have demonstrated this very crudely, you would work things out so there the number of top and bottom border characters worked out to an even number of tabs.

There may be more eloquent ways of doing this, but this method should work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Just a doubt!!!?? anishkumarv Linux - Server 3 07-10-2011 07:41 AM
One doubt please .. vibinlakshman Slackware 1 02-18-2009 07:57 PM
Boarders and marking on open applications Tony_photoplus Linux - General 6 08-24-2008 02:29 AM
doubt ? ashintoms Linux - Networking 1 07-24-2006 12:05 PM
DOUBT .- jordomi Linux - Distributions 2 08-23-2000 06:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration