Re: sed append question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi,

On Wed, Aug 19, 2009 at 13:24, Joseph L.
Casale<JCasale@xxxxxxxxxxxxxxxxx> wrote:
> Hey guys,
> I am trying to make sed append every line containing a string with another line.
> problem is the appended line needs to start with a tab:
> # sed -i '/string/a \tstuff\t\t\tmorestuff' file
> Obviously \t or \x09 etc doesn't get interpreted unless there are other characters
> before it? How can I get this to begin with a <tab>?

Hi,

The "a" command expects to be followed by a "\", so it's eating the
one in your first "\t". If you add another "\" it seems to work as you
want it to:

$ echo string | sed '/string/a \\tstuff\t\t\tmorestuff'
string
        stuff                   morestuff
$

HTH,
Filipe
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux