I'd like to execute sed inside a C Shell script.

On Mon, Mar 21, 2011 at 11:54 AM, Daniel Eggleston <[email protected]> wrote:
> \t usually works, depending on the sed implementation. (GNU sed allows \t)
>
> If you're typing this on the cmd line, you can type "^V[tab]" - Control-V,
> then hit tab. This will put a literal tab (instead of letting the shell
> interpret the tab).
>
> 2011/3/21 Henrique Rennó <[email protected]>
>>
>> Hello,
>>
>> I'd like to know how it's possible to solve the following problem:
>>
>> I have a file with the following pattern:
>>
>> this is some text<TAB><TAB><TAB>
>> and this is another text<TAB><TAB><TAB>
>>
>> I want to change that text into:
>>
>> this is some text<SPACE>some text<SPACE>some text<SPACE>some text
>> and this is another text<SPACE>some text<SPACE>some text<SPACE>some text
>>
>> I want to substitute every <TAB> pattern by <SPACE>some text
>>
>> The problem is that I need it inside a C Shell script, that is:
>>
>> if(-e myfile.txt)then
>>      sed "s/<TAB>/<SPACE>some text/g" myfile.txt > myanotherfile.txt
>> endif
>>
>> I also tried using ex and vi, but with no success:
>>
>> ex:
>>
>> cat << EOF >! ex.cmd
>> %s/^I/ some text/g
>> .
>> wq
>> EOF
>> ex - myfile.txt < ex.cmd
>>
>> vi:
>>
>> cat myfile.txt << EOF > /dev/null
>> %s/\t/ some text/g ; also: %s/<TAB>/ some text/g, where <TAB> is a
>> typed tab character; %s/^@/ some text/g; %s/^I/ some text/g
>> wq
>> EOF
>>
>> Is there another pattern for TAB besides the ones I tried? The TAB
>> character isn't being changed in any way. If I open the file with vi
>> and try chaging it, it works great with no problem. When opening the
>> file, tabs are shown as ^@.
>>
>> Thanks
>>
>> --
>> Henrique
>>
>> --
>> You received this message because you are subscribed to the Linux Users
>> Group.
>> To post a message, send email to [email protected]
>> To unsubscribe, send email to [email protected]
>> For more options, visit our group at
>> http://groups.google.com/group/linuxusersgroup
>
>
> --
>
>            Daniel
>
> --
> You received this message because you are subscribed to the Linux Users
> Group.
> To post a message, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit our group at
> http://groups.google.com/group/linuxusersgroup



-- 
Henrique

-- 
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup

Reply via email to