[Solved] SED - Bash - Inserting multi Tab character in the command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] SED - Bash - Inserting multi Tab character in the command
# 1  
Old 11-05-2012
[Solved] SED - Bash - Inserting multi Tab character in the command

Hello.
I am using :
Code:
sed -i -e '/§name_script§/a#'"${MY_TAB11}"'# \
#'"${MY_TAB1}"'The Standard way'"${MY_TAB7}"'# \
#'"${MY_TAB1}"'==============='"${MY_TAB7}"'# \ ' "$CUR_FILE"

Is there a better way to define "MY_TAB7","MY_TAB11" in other way than :
Code:
MY_TAB1=$'\t'
MY_TAB2=${MY_TAB1}$'\t'
MY_TAB3=${MY_TAB2}$'\t'
MY_TAB4=${MY_TAB3}$'\t'
MY_TAB5=${MY_TAB4}$'\t'
MY_TAB6=${MY_TAB5}$'\t'
MY_TAB7=${MY_TAB6}$'\t'
MY_TAB8=${MY_TAB7}$'\t'
MY_TAB9=${MY_TAB8}$'\t'
MY_TAB10=${MY_TAB9}$'\t'
MY_TAB11=${MY_TAB10}$'\t'
MY_TAB12=${MY_TAB11}$'\t'

# 2  
Old 11-05-2012
One way:
Code:
MY_TAB12=$(printf '\t%.0s' {1..12})
echo -n "$MY_TAB12"|od -c
0000000  \t  \t  \t  \t  \t  \t  \t  \t  \t  \t  \t  \t
0000014


Last edited by elixir_sinari; 11-05-2012 at 05:47 AM..
# 3  
Old 11-21-2012
Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash - Inserting non printable character(s) in string variable

Hello. I have a string variable named L_TEMP to test a very simple filter. L_TEMP="50AwL.|KWp9jk" I want to insert a non printable character between K and W. I have try this : linux-g65k:~ # a='50AwL.|K' linux-g65k:~ # b='Wp9jk' linux-g65k:~ # L_TEMP="$a$'\x07'$b" linux-g65k:~ # echo... (6 Replies)
Discussion started by: jcdole
6 Replies

2. Shell Programming and Scripting

How to substract selective values in multi row, multi column file (using awk or sed?)

Hi, I have a problem where I need to make this input: nameRow1a,text1a,text2a,floatValue1a,FloatValue2a,...,floatValue140a nameRow1b,text1b,text2b,floatValue1b,FloatValue2b,...,floatValue140b look like this output: nameRow1a,text1b,text2a,(floatValue1a - floatValue1b),(floatValue2a -... (4 Replies)
Discussion started by: nricardo
4 Replies

3. Shell Programming and Scripting

[SOLVED] sed command

Help request, I have tsted this line of code for hours. The first line works and the second line returns the message " sed: command garbled.....". This is running on solaris. The "${} variables all have good values when echoed. ## /bin/sed -n '1,25p' ${file} >> ${MailFile} ... (3 Replies)
Discussion started by: millerg225
3 Replies

4. UNIX for Dummies Questions & Answers

[solved]Help with a sed command

So I have a bunch of strings in a file. Example Line ./prcol/trt/conf/conf-app/jobdefinition/trt-pre-extr-trt-step.jdef Intended Result pre-extr-trt-step So far I have parsed it out to the last bit, echo $line | cut -d'/' -f7 | cut -d. -f1Result trt-pre-extr-trt-step So I added a... (2 Replies)
Discussion started by: J-Man
2 Replies

5. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

6. Shell Programming and Scripting

[Solved] sed : last character replace

Hi all , I have to write a shell script that takes a number as input , like 123 and the output will be 6 ,i.e the output will be the sum of digits of the input. I have an idea as follows, echo "123"|fold -1|tr '\n' '+'|bc But the problem is after " echo "123"|fold -1|tr '\n' '+' "... (5 Replies)
Discussion started by: M.Choudhury
5 Replies

7. Shell Programming and Scripting

Inserting newline in front of multi-character string

I'm working with a large file with multiple records, each record begins with ISA. The issue is, sometimes ISA is at the start of the line, sometimes it's in the middle of the line. So before I can csplit my main file into multiple records, I have to get each record header onto its own line. ... (7 Replies)
Discussion started by: verge
7 Replies

8. UNIX for Dummies Questions & Answers

SED + "tab" character

hi all, i would like your help with the "sed" command GIVEN a file with the following format, let s say : In the house, there are no.PCs 3 WHAT i would like to do is to replace the value "3" with another number IF i type the sed command like this : sed 's/'no.PCs3'/'no.PCs1'/g' >... (6 Replies)
Discussion started by: OneDreamCloser
6 Replies

9. Shell Programming and Scripting

problem with sed for inserting command

Hello, i use sed '/good/ a\INSERT' 1.txt command for insert a text on my file on linux butit does not work see the output : # sed '/good/ a\INSERT' 1.txt if_test=iso ifup=eth0 Hello World Bye now good INSERT # cat 1.txt if_test=iso ifup=eth0 Hello World Bye now (1 Reply)
Discussion started by: blackmetal
1 Replies

10. Shell Programming and Scripting

processing tab-formated output of command w/bash

I have a command that when ran it will have an output such as string LongerString string2 longerString2 More MoreStrings seperated by tabs. The command lists domains and their accounts set up in my server admin software (interworx). The end result will be that it will run rsync for... (2 Replies)
Discussion started by: sweede
2 Replies
Login or Register to Ask a Question