LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2013, 08:08 PM   #1
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Rep: Reputation: 30
tidy up script, code or file -- Any command can do?


I am having Centons 6. I got a simple request that many other programmers may interested too.

I would like to TIDY UP like LINE UP the
brackets of if, else, for, while

I'd like to read the code easily. Any Linux command can do this?


Code:
if(){
          for ($i=0; $i<$variable; $i++) {
    }

}else      {

   }

Last edited by fhleung; 05-06-2013 at 08:15 PM.
 
Old 05-06-2013, 08:46 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,222

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Most IDEs (e.g Eclipse) can do this. There are also program like this: http://astyle.sourceforge.net/
 
Old 05-06-2013, 09:25 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You might want to look at astyle.

jlinkels
 
Old 05-06-2013, 10:21 PM   #4
fhleung
Member
 
Registered: Aug 2004
Distribution: Lubuntu Live OS
Posts: 432

Original Poster
Rep: Reputation: 30
http://beta.phpformatter.com/
 
Old 05-07-2013, 01:55 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Vim may possibly be clever enough if you have the right formatting invoked.
 
Old 05-07-2013, 11:11 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
For C code, the usual standard is indent. It has options to achieve almost any standard that you prefer.
--- rod.
 
  


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
How to filter the linux kernel code based on config file. removing unnecessary code atulmt Linux - Kernel 4 06-29-2013 11:14 PM
Tidy shell script source file mmn357157 Linux - General 8 12-20-2008 07:33 PM
Tidy exit in C mykaitch Programming 11 03-23-2007 03:18 AM
Tidy? Which version to get and how? the_gripmaster Linux - Software 2 03-02-2007 01:37 AM
DISCUSSION: Tidy Up With HTML Tidy jeremy LinuxAnswers Discussion 0 10-10-2005 07:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:31 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