LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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: fc-15/ fc-20-live-usb/ aix
Posts: 5,232

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
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,169

Rep: Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944
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, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 13,704
Blog Entries: 22

Rep: Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602Reputation: 3602
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: 9,078
Blog Entries: 4

Rep: Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166Reputation: 3166
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 Jersey
Distribution: CentOS, Debian, Kali, Ubuntu, OpenSuse
Posts: 655

Rep: Reputation: 42
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: 8,745
Blog Entries: 5

Rep: Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141Reputation: 2141
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 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 01:20 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