LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-13-2018, 02:17 PM   #1
scottietheking
LQ Newbie
 
Registered: Feb 2018
Posts: 3

Rep: Reputation: Disabled
creating a table in Linux?


how do you create an expense bash script in order from largest or biggest to smallest and reverse? I have like 12 different characters. How to have different columns line up? Please advise.
 
Old 03-13-2018, 02:18 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,267

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
i would look into awk and maybe sort ?
 
Old 03-13-2018, 03:28 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,511

Rep: Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006
Can you show us what you have and how you want it to be?
 
Old 03-13-2018, 09:25 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,794
Blog Entries: 27

Rep: Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635Reputation: 4635
Here's an old LQ thread that might help: https://www.linuxquestions.org/quest...sh-4175585504/
 
Old 03-14-2018, 09:00 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179Reputation: 3179
Probably the best-looking table would be obtained by generating HTML. Open the file in any web browser to produce a very nicely rendered page for printing.

Also, if it were me, I wouldn't bother with actual "bash scripting." You don't have to. Insert a #!shebang line as the first line of the file, specifying the name of the scripting-language processor of your choice. Bash will silently "fork" that command-processor – Perl, PHP, Ruby, etc. – to run your script, and no one will ever know. Although "pure bash scripting" has been used to do very remarkable things, to me it's an exercise in futility.

Last edited by sundialsvcs; 03-14-2018 at 09:05 AM.
 
Old 03-14-2018, 04:21 PM   #6
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: CentOS, Debian & Fedora
Posts: 708

Rep: Reputation: 53
scottietheking, I recommend you use awk. It is funny, I am taking a scripting course in college and this is kind of similar to one of my homework assignments. I am not home now but if I have time later I can post what I did for my assignment. Let me know.
Thank you
 
Old 03-15-2018, 03:44 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,229
Blog Entries: 9

Rep: Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617
scottietheking, is your question about scripting logic, or about getting output into a table layout in the terminal?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
creating a table in Linux scottietheking Linux - Newbie 9 02-11-2018 09:33 PM
Creating a condensed table from a pre-existing table in putty Deedee393 Linux - Newbie 3 05-16-2012 12:07 PM
creating table ilinuxnewbie Linux - Newbie 2 08-04-2009 12:15 AM
creating table headers in bash panchosansa Programming 3 10-16-2006 05:22 AM
Need help creating routing table on linux itrap2003 Linux - Networking 5 06-25-2004 10:18 PM

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

All times are GMT -5. The time now is 11:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration