LinuxQuestions.org
Review your favorite Linux distribution.
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 08-30-2010, 06:14 AM   #1
cruzdelsur
Member
 
Registered: Aug 2010
Location: Chile
Distribution: Ubuntu 12.04
Posts: 69

Rep: Reputation: 0
closing parenthesis script


Hi guys,
This is a weird question. I'm not sure if it can be done or not.
Here is the thing. I have a file with several parentheses, both () and []. All of them should be closed, but apparently, one of them is open. In order to run a program, I need all of them to be closed...
For example, if I write: ((bla (bla (bla)) I would have two parentheses missing. That's what I mean.
But I have several parentheses in the file... it would take me ages to do it manually. Is there a way to check which parenthesis is open? can it be done?
Thanks!!
 
Old 08-30-2010, 06:23 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

I see you use Windows so you could use Notepad++ which has some great plugins to search for matching braces/brackets and so on (TextFX Quick). Also when you select a language, for example Perl or Shell, then the parentheses get highlighted in a different color if not matched which improves visibility very much.

Since Notepad++ is a derivative of SciTe, I imagine that would have similar behavior. I'm not 100% sure but maybe Emacs also has this behavior/function.

Kind regards,

Eric
 
Old 08-30-2010, 07:40 AM   #3
cruzdelsur
Member
 
Registered: Aug 2010
Location: Chile
Distribution: Ubuntu 12.04
Posts: 69

Original Poster
Rep: Reputation: 0
Hi Eric,

Thanks for your quick reply! I'm using Windows but I have access to a linux server, so I can work there too. I've tried the Notepad++ and it highlighted all the parentheses, I cannot find the one that it's not closed. Any other option?
 
Old 08-30-2010, 08:16 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
What program/language is it? Shouldn't it tells you about the offending line number when you try to run it?
 
Old 08-30-2010, 08:38 AM   #5
cruzdelsur
Member
 
Registered: Aug 2010
Location: Chile
Distribution: Ubuntu 12.04
Posts: 69

Original Poster
Rep: Reputation: 0
Well colucix, I'd wish it tells me! it only says "Error reading tree file: Missing closing ')' in tree" grrr
It's a pain in the neck because it's a result from another program...
But, you gave me an idea... you didn't mean it, but it made me think I could try another program to open it... and now I can open it. It seem the other program had a problem with the file :S there were none missing parenthesis! :S
Thanks anyways!!
 
Old 08-30-2010, 09:55 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Glad you got it solved. Have fun using Linux.

Kind regards,

Eric
 
  


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
script closing window lk4772 Linux - Newbie 8 11-23-2009 03:39 PM
Iptables script, and closing ports on linux box sarajevo Linux - Security 7 12-27-2006 05:06 AM
linux SU command closing script prematurely. help please? Frelov Programming 4 02-20-2006 01:14 PM
vim matching parenthesis rohr Linux - Software 2 04-23-2005 05:12 PM
Can't rename file with parenthesis in name pleasehelp Linux - Newbie 4 03-16-2004 03:01 PM

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

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