LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-13-2018, 01: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, 01:18 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

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

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Can you show us what you have and how you want it to be?
 
Old 03-13-2018, 08: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: 19,323
Blog Entries: 28

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

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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 08:05 AM.
 
Old 03-14-2018, 03:21 PM   #6
ceantuco
Member
 
Registered: Mar 2008
Location: New York
Distribution: Debian
Posts: 809

Rep: Reputation: 88
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, 02:44 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

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


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

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

All times are GMT -5. The time now is 04:29 PM.

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