all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alexis Roda <alexis.roda.villalonga@gmail.com>
Subject: Re: regex search and replace
Date: Mon, 23 Oct 2006 00:08:09 +0200	[thread overview]
Message-ID: <453BEBC9.2000001@gmail.com> (raw)
In-Reply-To: <m3y7r8jbqz.fsf@localhost.localdomain>

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 ,<SPC> RET




HTH

  parent reply	other threads:[~2006-10-22 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-22 21:12 regex search and replace Gary Wessle
2006-10-22 21:45 ` Gary Wessle
2006-10-22 23:24   ` Peter Dyballa
2006-10-24 15:37   ` rgb
2006-10-22 22:08 ` Alexis Roda [this message]
2006-10-23 13:29 ` aartist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=453BEBC9.2000001@gmail.com \
    --to=alexis.roda.villalonga@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.