Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Use of sed
Date: Wed, 24 Jun 2009 11:28:12
Message-Id: 200906241328.06066.wonko@wonkology.org
In Reply to: [gentoo-user] [OT] Use of sed by Peter Humphrey
1 Peter Humphrey writes:
2
3 > I'm reduced to asking a newcomer's question: how can I make sed recurse
4 > down a directory tree?
5
6 find . -type f -exec sed -i 's/foo/bar/g' '{}' \;
7
8 > And while I'm at it, how do I change the field
9 > separator from / to enable me to search on that character?
10
11 Well, just change it :) It does not need to be a /, it is always the first
12 character after the s. sed 's%foo%bar%g' will work just the same.
13
14 I used to use the § character because it is probably not being used in any
15 of my file names, but maybe it was too special, because kate dropped it
16 silently from my shell scripts I edited, and hell broke loose.
17
18 > I used to have a "SED and AWK" book, but it seems to have walked; and I
19 > can't see anything helpful from a Google search.
20
21 man sed answers your second question :)
22
23 Wonko

Replies

Subject Author
Re: [gentoo-user] [OT] Use of sed Peter Humphrey <peter@××××××××××××××.org>