Scripting help please 2005-05-04 - By Ed Wilts
Back On Wed, May 04, 2005 at 06:34:30PM +0530, Truejack wrote: > I need some scripting help please. > > I have a file which has the following output. > I need to change all the commas after the $ to a * (or any other > character other than a comma). > Only the commas after the $ need to be changed. > > 109889-01 : 109353-04,109353-04 : : $ SUNWkvmx, SUNWkvm, SUNWctu, SUNWmdb
If you have the mysql package installed, you've got a fantastic tool called replace. In my opinion, this should be taken out of mysql and bundled in a more common location like coreutils. You don't need a mysql server running - just the client package installed.
replace ', ' '* ' -- $filename
replace can process multiple files at once and does the changes in place.
[ewilts@(protected) ewilts]$ cat foo 109889-01 : 109353-04,109353-04 : : $ SUNWkvmx, SUNWkvm, SUNWctu, SUNWmdb [ewilts@(protected) ewilts]$ replace ', ' '* ' -- foo foo converted [ewilts@(protected) ewilts]$ cat foo 109889-01 : 109353-04,109353-04 : : $ SUNWkvmx* SUNWkvm* SUNWctu* SUNWmdb
-- Ed Wilts, RHCE Mounds View, MN, USA mailto:ewilts@(protected) Member #1, Red Hat Community Ambassador Program
-- Taroon-list mailing list Taroon-list@(protected) http://www.redhat.com/mailman/listinfo/taroon-list
Earn $52 per hosting referral at Lunarpages.
|
|