paste more than 12 files together


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers paste more than 12 files together
# 1  
Old 08-01-2008
Power paste more than 12 files together

Hi,

1. How can I get around the issue with pasting more than 12 files together?

2. paste file1 file2 > file3........how can I do this with awk??

Thanks!
# 2  
Old 08-02-2008
Hi.

Using simple data files, intermediate files is one answer:
Code:
#!/bin/ksh -

# @(#) s1       Demonstrate pasting with intermediate files.

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1) paste
set -o nounset
echo

FILE1=data1
FILE2=data2
FILE3=data3
FILE4=data4

echo
echo " Data file $FILE1:"
cat $FILE1

echo
echo " Data file $FILE2:"
cat $FILE2

echo
echo " Data file $FILE3:"
cat $FILE3

echo
echo " Data file $FILE4:"
cat $FILE4

echo
echo " Intermediate results:"
paste $FILE1 $FILE2 >t1
cat t1

echo
paste $FILE3 $FILE4 >t2
cat t2

echo
echo " Results of pasting intermediate result files:"
paste t1 t2

exit 0

Producing:
Code:
$ ./s1

(Versions displayed with local utility "version")
SunOS 5.10
ksh M-11/16/88i
paste - no version provided for /usr/bin/paste.


 Data file data1:
a
b
c

 Data file data2:
d
e
f

 Data file data3:
g
h
i

 Data file data4:
j
k
l

 Intermediate results:
a       d
b       e
c       f

g       j
h       k
i       l

 Results of pasting intermediate result files:
a       d       g       j
b       e       h       k
c       f       i       l

cheers, drl
# 3  
Old 08-04-2008
use zsh
you can do that
# 4  
Old 08-04-2008
Friends:

Solution 1 is ok. I am more interested in syntax using AWK to replace PASTE or other paste option to allow me to paste more than 12 files.

paste limit of only 12 files.


Solution 2 is not working. Please provide code. I tried it (zsh) not working.

Thanks!
# 5  
Old 08-04-2008
# 6  
Old 08-04-2008
Hi.

There is a perl version of paste at PPT: paste

This test script:
Code:
#!/bin/bash -

# @(#) s1       Demonstrate paste written in perl, Perl Power Tools Suite.

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1)
set -o nounset

N=${1-15}

FILE1=data1
FILE2=data${N}

echo
echo " Sample: data file $FILE1:"
cat $FILE1

echo
echo " Sample: data file $FILE2:"
cat $FILE2

files=$( echo data? ; echo data?? )
echo
echo " Results:"
./paste.perl -d " " $files

exit 0

Produces this (with simple data files):
Code:
$ ./s1

(Versions displayed with local utility "version")
SunOS 5.10
GNU bash 3.00.16

 Sample: data file data1:
1.1
1.2

 Sample: data file data15:
15.1
15.2

 Results:
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1
1.2 2.2 3.2 4.2 5.2 6.2 7.2 8.2 9.2 10.2 11.2 12.2 13.2 14.2 15.2

Best wishes ... cheers, drl
# 7  
Old 08-04-2008
friends:

Thank you for the replies. After look at all the replies, I think I din't make my questions clear. Here, it is again:
I have 13 files of data.
file1
cat fiel1
1

file2
cat file2
2

file3
cat file3
3

file4
cat file4
4

file5
cat file5
5

file6
cat file6
6

file7
cat file7
7

file8
cat file8
8

file9
cat file9
9

file10
cat file10
10

file11
cat file11
11

file12
cat file12
12

file13
cat file13
13

paste file1 file2 file3 file4 file5 file6 file7 file8 file9 file10 file11 file12
1 2 3 4 5 6 7 8 9 10 11 12

paste file1 file2 file3 file4 file5 file6 file7 file8 file9 file10 file11 file12 file13
limit 12 files only

QUESTION:
how can I paste these 13 files together? I want my results:
1 2 3 4 5 6 7 8 9 10 11 12 13

can this be done with awk,sed,per,......or......?

Any taker! Thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to paste multiple files in parallel?

Hi all, I am trying to paste thousands of files together into a matrix. Each file has only 1 column and all the files have the same number of rows (~27k rows). I tried paste * > output as well as some other for loops but the output only contains the columns from the 1st and last files. The... (8 Replies)
Discussion started by: notimenocall
8 Replies

2. Shell Programming and Scripting

Paste files of varying lengths

I have three files of varying lengths and different number of columns. How can I paste all three with all columns aligned? File1 ---- 123 File2 ---- 234 345 678 File3 ---- 456 789 Output should look like: 123 234 456 345 789 (6 Replies)
Discussion started by: Un1xNewb1e
6 Replies

3. Shell Programming and Scripting

paste mutiple files in a loop

file1.txt file2.txt file3.txt desired output is each file is in the same directory, hasthe same number of columns but different rows. i want to be able to paste them into one file. thanks! (5 Replies)
Discussion started by: johnkim0806
5 Replies

4. Shell Programming and Scripting

Paste second columns from files to its corresponding file

Hi All, I have two sets of files. One set with extension .txt This set has file names with numbers like these. 1.txt, 2.txt, 3.txt until extactly 100.txt. The .txt files look like these: 0.38701788 93750 0.38622013 94456 0.38350296 94440 0.38282126 94057 0.38282126 94439 0.35847232... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. UNIX for Dummies Questions & Answers

Copy/Paste data in files

Hi, I want to put the following values into Variables R2=0.999863 , V2=118.870318 , D2=-178.887511 and so on. There are six values for each variable R2-R8, V2-V8 and D2-D8, total of 18 values for all the variables. Can any one help me to copy and paste all the values in their respective... (2 Replies)
Discussion started by: sullah
2 Replies

6. Shell Programming and Scripting

Paste the files

Dear All, I have thousands of files (consists of one column each) and i need to paste all the columns in a single file as follows: I have files - file1, file2, file3, .......file2000. I need to paste all the files in a single file of separate columns as shown below: file1 file2 file3 ... (3 Replies)
Discussion started by: Fredrick
3 Replies

7. Shell Programming and Scripting

paste several files

Hi everybody: I tried to paste several files which have the same pattern name file like this: down_s1.dat, down_s2.dat, down_s3.dat, down_s4.dat ... down_s10.dat So I have tried to do it as: paste down_s.dat > final.dat But it does not work correctly. Any suggestion. Thanks in... (1 Reply)
Discussion started by: tonet
1 Replies

8. UNIX for Dummies Questions & Answers

paste 2 files ( it is possible???)

Hello all, I have two files: file1: data1 data2 data3 data4 data5 data6 data7 data8 data9 file2: reference I need to paste both files with the following output: data1 data2 data3 reference data4 data5 data6 reference data7 data8 data9 reference I tried using the paste... (3 Replies)
Discussion started by: mig28mx
3 Replies

9. Shell Programming and Scripting

Paste the files contents differently

Hello , I want to segregate by file contents in a much simpler format ie input file Wednesday May 16 11:59:44 IST 2007 90376 44136 process1 pid1 90200 43208 process1 pid2 90200 43208 process1 pid3 90200 43208 process1 pid4 Wednesday May 16 12:00:45 IST 2007 90376 44136 process1 pid1... (1 Reply)
Discussion started by: er_aparna
1 Replies

10. Shell Programming and Scripting

Need a Help with paste 2 files since the output is not what i want

Need a Help with paste 2 files since the output is not what i want ie: i have 2 files pwd /home/pavargaz/alejo/scan01/nokia/2006/abril/bavaria/chu0 $ cat filechu chu0 dia Cantidad 01 257 02 262 03 260 04 58 $pwd ... (3 Replies)
Discussion started by: alexcol
3 Replies
Login or Register to Ask a Question