"\s" in sed?
dj at linuxfromscratch.org
Mon Mar 7 22:48:42 PST 2011
On 03/07/2011 09:13 AM, Tadeus (Eus) Prastowo wrote:
> I am in 6.33. Perl-5.12.3 when I read the following sed command:
> sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|"
> Although I see that "\s" means space character, I cannot find "\s"
> documented in the info file. Quick googling also does not return a
> good result about "\s". Where do you guys find that "\s" other than in
> the source code?
Google for "regular expressions" or more commonly referred to as "regex"
Here is a whole site dedicated to it that I just found:
http://www.regular-expressions.info/reference.html contains your \s
http://www.regular-expressions.info/tutorial.html contains a
tutorial...it's geared towards windows I think, but good enough. Be
aware that there are differences in regex implementations as well and
only some are pointed out in a quick perusal of the tutorial.
Also of use (regarding sed at least) is this site:
I've used quite a few of the one liners over the past 10 years or so. :)
-- DJ Lucas
More information about the lfs-support