[thelist] Basic GREP help

Justin King getafixx at getafixx.com
Fri Jan 14 09:12:38 CST 2005


Hi Steve,

You probably want to use a regular expression to do this, not grep

Search for
"([0-9]*) - " (with out the inverted commas)
the [0-9] matches a single number, the * matches multiples of what ever is
in the [] and the () takes whatever is found and puts it into a variable (\1
in this case)

replace with
"\1 (a) \1 (b) \1 - "(with out the inverted commas)
basically this will output whatever was found in the ([0-9]*) 3 times as
well as the (a) and the (b)


I can't help you with actually doing it as I am on a windows machine and
can't get to a *nix machine to test.

if you are in windows get yourself a copy of editplus (www.editplus.com) and
open your file and enter the info above and it should work.

Hope this helps

Justin

----- Original Message ----- 
From: "Steve Bissonnette" <steve at plankdesign.com>
To: <thelist at lists.evolt.org>
Sent: Friday, January 14, 2005 2:40 PM
Subject: [thelist] Basic GREP help


Hi,
Could someone help me out with this basic GREP problem ?


I have a list of items ... Each on it¹s own line....
(Here¹s a example of part of the list)

7322 - Adjustment & collection services
7323 - Credit reporting services
7334 - Photocopying services
7336 - Commercial art / graphic design
7338 - Secretarial services
7350 - Miscellaneous equipment rental


I need to transform that list into this ..

7322 (a) 7322 (b) 7322 - Adjustment & collection services
7323 (a) 7323 (b) 7323 - Credit reporting services
7334 (a) 7334 (b) 7334 - Photocopying services


Etc ...
(take the 4 digit code and ³pasting it twice at the start of the line with
the delineator between)



What would be a GREP search pattern that would do this ?


Many thanks,
Steve
-- 
steve bissonnette
steve at plankdesign.com

PLANK. A multi-faceted-media company.
http://www.plankdesign.com
v. 514.875.0003   f. 514.875.7611

-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !




More information about the thelist mailing list