Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-04-2009, 07:40 AM   #16
LQ Newbie
Registered: Mar 2009
Posts: 26

Original Poster
Rep: Reputation: 0

it a good idea to wtite in c++. I shoould have thought about it.

thank you very much!!!!!!!!!
Old 12-04-2009, 09:15 AM   #17
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,889

Rep: Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355Reputation: 1355
Generally speaking, for this task I would use either 'awk' or, better yet, Perl.

The task that you are seeking to do is an elementary one for regular expressions, which you see being used here in almost every one of the examples.

Remember this cardinal rule: "do not do a thing already done."

Your purpose should be to accomplish your task, as quickly and as simply (but also as accurately) as you possibly can, while expending the least amount of "unique effort" in the doing of it. So, "there is no reason to write a 'C' program to do this, even if you can." Likewise, IMHO, there's a contra-indication to writing a messy "sed"-based solution that you could not read and understand a week from now without learning it all over again.

No matter what you are doing, remember that thousands of people before you have been asked to do the same thing. They built, debugged, perfected, and then gave-away their tools to the entire community. So, in nearly every case, your modus operandi should not be "to hand craft a solution," but rather, "to find and use a solution that already exists."


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
line break on bash script ZAMO Linux - General 5 04-24-2010 12:27 PM
Grep words and paste is on the same line say_hi_ravi Programming 7 10-31-2008 06:56 AM
How do I extract characters from several words on a line? MheAd Linux - Newbie 22 06-23-2008 10:22 PM
CVS's line break management zWaR Programming 1 04-16-2007 09:00 PM
BASH: First words in a line JordanH Programming 7 10-24-2004 10:00 AM

All times are GMT -5. The time now is 02:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration