From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexis Roda Newsgroups: gmane.emacs.help Subject: Re: regex search and replace Date: Mon, 23 Oct 2006 00:08:09 +0200 Message-ID: <453BEBC9.2000001@gmail.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1161554953 6315 80.91.229.2 (22 Oct 2006 22:09:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Oct 2006 22:09:13 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 23 00:09:12 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GblVB-0000iv-Pq for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Oct 2006 00:09:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GblVB-0007Gr-3O for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Oct 2006 18:09:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GblU6-0006dX-Cs for help-gnu-emacs@gnu.org; Sun, 22 Oct 2006 18:07:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GblU3-0006aD-3c for help-gnu-emacs@gnu.org; Sun, 22 Oct 2006 18:07:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GblU2-0006Zp-PQ for help-gnu-emacs@gnu.org; Sun, 22 Oct 2006 18:07:54 -0400 Original-Received: from [66.249.92.168] (helo=ug-out-1314.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GblU2-0000wh-Fr for help-gnu-emacs@gnu.org; Sun, 22 Oct 2006 18:07:54 -0400 Original-Received: by ug-out-1314.google.com with SMTP id 36so1223013uga for ; Sun, 22 Oct 2006 15:07:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=Mmb17TxdjAwHytzZCxSi/pkoesQHKDMOU7LIesaokA5iEnkALditjD0RrMCbPpf2pPvdEyJSbS8sZeFD5n0nbuLUoFXCtBfJzGVHXv4lNP3mcnE2Ycc1jp+n3GXEggLEeCFM1eQ5AeacyjH4bZauGOTeDbJ9Mye8rXZOU40rQNA= Original-Received: by 10.66.224.3 with SMTP id w3mr6246643ugg; Sun, 22 Oct 2006 15:07:52 -0700 (PDT) Original-Received: from ?192.168.1.10? ( [81.38.254.12]) by mx.google.com with ESMTP id s1sm524273uge.2006.10.22.15.07.51; Sun, 22 Oct 2006 15:07:52 -0700 (PDT) User-Agent: Mozilla Thunderbird 1.5.0.5 (X11/20060719) Original-To: help-gnu-emacs@gnu.org In-Reply-To: X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38179 Archived-At: En/na Gary Wessle ha escrit: > Hi > > I am using GNU emacs 21.4.1 and wanting to use regex to do the > following. > > I have few lines in the format > -rw-r--r-- 1 fred fred 56823 Oct 14 01:32 samcar > ... > -rw-r--r-- 1 fred fred 56823 Oct 14 01:32 manham > > I want to end up with > { "sam/car", ..., "man/ham" } > > so my step by step approach is to remove the > " -rw-r--r-- 1 fred fred 56823 Oct 14 01:32 " > > then to change aaabbb with aaa/bbb. M-x replace-regexp RET ^.*\(\w\{3\}\)\(\w\{3\}\)$ RET "\1/\2" RET You can find more info on REs here: http://www.gnu.org/software/emacs/manual/html_node/Regexps.html#Regexps > then to replace end of line with (", ") M-x replace RET C-q C-j RET , RET HTH