Insert TAB in echo statement


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Insert TAB in echo statement
# 1  
Old 08-25-2005
Insert TAB in echo statement

Hi,

Can some1 help me to output a tab in an echo statement.
I have tried
echo "RNC: \t NODEB"
but dont get the correct output.

I am a beginnger to unix, so pls hold back the laughs....if u can
# 2  
Old 08-25-2005
using gnu's echo you need to ad the -e argument.

echo -e "RNC: \t NODEB"
# 3  
Old 08-25-2005
as a beginner you won't perhaps know this (and, besides, this is most often ignored by even the most veteran UN*Xers): 'echo' should not be used. Use "print" instead:

print - "abc\tdef"

will do exactly what you want - regardless of what version of print you are using.

bakunin
# 4  
Old 08-25-2005
Er, no.

Quote:
Originally Posted by bakunin
Use "print" instead:
What Unix are you using? In GNU/Linux, "print" is an alias to "run-mailcap" which certainly does not do what you're saying it does. It doesn't exist at all in OpenBSD, which is the other Unix I've got access to at the moment.
# 5  
Old 08-25-2005
Perhaps bakunin was thinking of printf which is built-in to ksh and bash and should also be available as an executable.
# 6  
Old 08-26-2005
"print" is an internal ksh-command. AFAIK it is also an internal command in the bash.

I don't know about OpenBSD and I definitely don't know about Linux (honestly, IMHO Linux is to UNIX what Lego is to construction works), but as much as I know there are many flavours of Linux all with different sets of (mostly unsensible) aliases, therefore what you say may or may not be true for another of the seveteen dozens of major distribution. (Still, this disdain of mine may reflect only personal preferences and I don't intend to start a religious war (tm) here about Unix flavours or flavours of somewhat-Unix-like OSes.)

I'd like to take back my obviously inflammatory remark in the general form i offered it and state instead that what i said is only true for real OSes with real shells, which have an internal "print" command.

bakunin

PS: i use AIX, HP-UX, SunOS and (most enjoyable) VMS.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

2. UNIX for Dummies Questions & Answers

Vi - insert a tab between words?

I have several lines in a file that I want to replace a space with a tab. For example: 111047 Julie Jones email@email.com 111047 Julie Jones email@email.com I want to replace the space after the word "jones" with a tab. How do I achieve that in Vi? Please assist. Thanks! (5 Replies)
Discussion started by: onlinelearner02
5 Replies

3. UNIX for Dummies Questions & Answers

insert whitespace (tab) at start of each line

Hi all, I have this: begin data; dimensions nind=168 nloci=6; info BDT001.4 ( 1 , 1 ) ( 1 , 12 ) BDT003.4 ( 1 , 1 ) ( 12 , 12 ) BDT007.4 ( 1 , 1 ) ( 12 , 12 ) BDT009.4 ( 1 , 32 ) ( 12 , 22 ) etc, etc And need this: begin data; dimensions nind=168 nloci=6; info ... (2 Replies)
Discussion started by: MDeBiasse
2 Replies

4. Shell Programming and Scripting

HOw to provide tab in a file using echo

Hi , I have a file with 5 colums each are sererated by tab. I am reading each line and adding extra two columns , the value depends on 5th column.. Now am trying to store each and every record in another file.. using the command echo $line $6thcol $7th col $line - readin the each... (2 Replies)
Discussion started by: arukuku
2 Replies

5. UNIX for Dummies Questions & Answers

How to echo space or tab delimited values into rows?

Hi, I have the following code: LIST=`ls | grep '.sql$'` echo $LIST The above code will give me something like.. file1.sh file2.sh file3.sh file4.sh file5.sh I want to display the values into rows using echo like... file1.sh file2.sh (5 Replies)
Discussion started by: adshocker
5 Replies

6. Shell Programming and Scripting

insert LF and TAB for formatting

trying to insert a LF and 2 TABs for this: sed 's/<td><\/td>/<td>\n\t\t<\/td>/' infile. but, I'm not getting the syntax for inserting the LF and TABs correct (1 Reply)
Discussion started by: dba_frog
1 Replies

7. Shell Programming and Scripting

How is use sselect statement o/p in insert statement.

Hi All, I am using Unix ksh script. I need to insert values to a table using the o/p from a slelect statement. Can anybody Help! My script looks like tihs. ---`sqlplus -s username/password@SID << EOF set heading off set feedback off set pages 0 insert into ${TB_NAME}_D... (2 Replies)
Discussion started by: nkosaraju
2 Replies

8. Shell Programming and Scripting

sed: how to insert tab?

Hi, I'm using the following to insert lines into file: sed ${rowNr}i'\ first row\ second row\ third row\ ' file.txt How can I add tab in front of each added line? "\t" or actual TAB does not seem to work? Thanks! (2 Replies)
Discussion started by: Juha
2 Replies

9. UNIX for Dummies Questions & Answers

How to insert tab at specified column.HELP

I have input like: 1234567890 cut -c1-3,6-7,9-10 input > output Now I got 1236790. I want to insert space between each cut. So the output like: 123 67 90 Can anybody help? Thanks. (7 Replies)
Discussion started by: sslr
7 Replies

10. Shell Programming and Scripting

How to echo a <tab> space?

I've tried this: echo "${bold}User${norm} : u"\t"${bold}All Users ${norm} : a\t" and i got this output: Specific User : u\tAll User: a\t (14 Replies)
Discussion started by: laila63
14 Replies
Login or Register to Ask a Question