Tinkering with sed, I have manage to try using regular expressions using backreferences using the most common \N where N is the number of position inside the parenthesis. Searches and replaces the zoo.color to zoo['color'] or zoo.animals to zoo['animals']: cat zoo.js | sed -E "s/(zoo)(\.)([a-zA-Z0-9]*)/\1['\3']/g"|less \1 = is the characters inside the first parenthesis w/c is the zoo \3 = is the characters inside the third parenthesis which involves alpha-numeric -E will interpret as regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's) Another example, you can use this for replacing such a string let say, in a SQL statement, example SQL string: CREATE DEFINER=`mysqluser`@`%` FUNCTION `total`(cost DOUBLE, income DOUBLE, lng2 DOUBLE) RETURNS double And you wanted to remove DEFINER=`mysqluser`@`%` and allow FUNCTION to be a dynamic string so you'll just need to catch tha...
I found ShellEd when googling for any shell editor. It was trouble at first because there's no how-to that directs me, where I expect to have a direct link that I can copy-en-paste to my Eclipse for installation. So what I did, I download ShellEd (as of this writing file version ShellEd-Update-2.0.0_M3.zip) from sourceforge.net and install, as required, the Linux Tools . After installing Linux Tools, I then locate thru archive the ShellEd zip file and install it successfully. It works good and I feel satisfied with this cool tool to be embedded in eclipse. The sample attached shell script is from JBoss twiddle. It does supports syntax highlighting, intellisense which is cool. Hope this helps.
pdftotext is a tool in Linux that would extract any text readable, which was formatted prior from PDF. When you arrive on not able to find this helpful tools from Linux of your favorite distro, you can find it in the net for poppler utils which comprises the pdftotext binary file. It's codebase is base on XPdf 3.0. For CentOS, do yum install poppler* which would install the developer package, poppler package, and the util package of poppler. Hope this helps ;-).
Comments