How to inset tabs in ARRAYS


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to inset tabs in ARRAYS
# 1  
Old 05-26-2009
How to inset tabs in ARRAYS

Hi I have the follwong command at the end of the program

print arr[1]" "arr[2]" "arr[3]}

I would like to insert the tabs in these three values and 3 values should be in single line.

Would u guys plz Smiliesuggest me what to do!
# 2  
Old 05-27-2009
Quote:
Originally Posted by repinementer
Hi I have the follwong command at the end of the program

print arr[1]" "arr[2]" "arr[3]}

I would like to insert the tabs in these three values and 3 values should be in single line.

Would u guys plz Smiliesuggest me what to do!
are you using that print command inside an awk??
if so just set OFS=" "
or else use \t
or else place a tab inbetween

Last edited by vidyadhar85; 05-27-2009 at 12:39 AM..
# 3  
Old 05-27-2009
Use printf:

Code:
printf("%s\t%s\t%s\n",arr[1],arr[2],arr[3])


-Devaraj Takhellambam
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Need to inset double quotes in a file

Hi, I have echo "start="\2014"">/tmp/read.txt echo "end="2014"">>/tmp/read.txt more /tmp/read.txt start=2014 end=2014 But i wish to have double quotes in the read.txt start="2014" end="2014" Can you please tell me how ? (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

3. Shell Programming and Scripting

Number of Tabs

hi, I have a text and values are seperated by tab. each line has different tabs. I am getting values and writing values in a specific format using: awk 'NR>1 {print "First value: "$1" Second:"$2" Third: "$3 } /home/gcsw/readtext.txt > /home/gcsw/writeresults.txt but how can i determine... (3 Replies)
Discussion started by: gc_sw
3 Replies

4. Shell Programming and Scripting

too many tabs

Hi, I have a file that has too many tabs between columns. I cannot get the tabs out. Basically the tab between column 1 and 2 are fine but between 2/3, 3/4 etc are like 5 tabs. How do I get rid of these 5 tabs so its just 1 tab. thanks (3 Replies)
Discussion started by: phil_heath
3 Replies

5. UNIX and Linux Applications

GVIM with tabs

Hi People, Does gvim latest versions support tabs. I would like to open different files in tabs rather than new windows or split windows. I would like to whether the current version supports it, if it doesn't then how to add such feature. Thanks, :) (2 Replies)
Discussion started by: rimser9
2 Replies

6. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

7. UNIX and Linux Applications

VIM tabs...

hello i saw a tutorial in this link that explains tabbed editing with VIM. it says: :tabnew :tabe but when I try in my own computer, it says: "Not an editor command" I connect to the Tru64 server using CRT 6.0. what's going wrong? (2 Replies)
Discussion started by: xyzt
2 Replies

8. Shell Programming and Scripting

removing tabs

Hi Everyone, Im trying to write a shell script that removes a "newline character followed by a tab" throughout a file. basically it should get rid of it. Here's an example File Before The cat sat on the mat File After The cat sat on the mat This message writing screen has... (7 Replies)
Discussion started by: nbvcxzdz
7 Replies

9. UNIX for Dummies Questions & Answers

Cron Tabs

I am on AIX 5.1 If I have a crontab that looks like this 01 1 * * 6 What does the 6 mean ? if the * means that everyday it should run then why would the 6th day be signified ? Shouldn't it be a * also? Thanks (1 Reply)
Discussion started by: rocker40
1 Replies
Login or Register to Ask a Question