On Sun, 8 Jun 2008, Alexandre Conrad wrote:

> I'm having a hard time to figure out how to represent the tab character
> in my regular expression pattern using sed:
>
> this doesn't interpret the tab:
> cat foo.txt | sed 's/\tfoo/\tbar/'

By the way:

  $ sed 's/\tfoo/\tbar/' foo.txt

is cheeper :)

Various ways to do that.  Would this help?

$ ./busybox --help 2>&1 | head -n1
BusyBox v1.11.0.svn (2008-06-08 18:02:03 CEST) multi-call binary

$ echo "abc           foo     123" | hxdmp
00000000: 6162 6309 0966 6F6F 0931 3233 0A         abc..foo.123.
$ ./busybox echo "abc         foo     123" | ./busybox sed -e "s/\tfoo/\tbar/" 
| hxdmp
00000000: 6162 6309 0962 6172 0931 3233 0A         abc..bar.123.
$ ./busybox echo "abc         foo     123" | ./busybox sed -e 
"s/\011foo/\tbar/" | hxdmp
00000000: 6162 6309 0966 6F6F 0931 3233 0A         abc..foo.123.
$ ./busybox echo "abc         foo     123" | ./busybox sed -e 
"s/[[:space:]]foo/\tbar/" | hxdmp
00000000: 6162 6309 0962 6172 0931 3233 0A         abc..bar.123.


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to