Share your knowledge at the LQ Wiki.
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, 08: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, 10:15 AM   #17
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,986

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

All times are GMT -5. The time now is 03:21 AM.

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