![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| paste several files | tonet | Shell Programming and Scripting | 1 | 10-05-2007 07:08 AM |
| paste 2 files ( it is possible???) | mig28mx | UNIX for Dummies Questions & Answers | 3 | 06-21-2007 08:51 AM |
| Paste the files contents differently | er_aparna | Shell Programming and Scripting | 1 | 05-16-2007 01:29 AM |
| Need a Help with paste 2 files since the output is not what i want | alexcol | Shell Programming and Scripting | 3 | 01-09-2007 12:47 AM |
| awk or sed or paste | leprichaun | UNIX for Dummies Questions & Answers | 3 | 11-16-2003 03:58 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Code:
paste one two three four five six seven eight nine ten eleven twelve > tmp paste tmp thirteen > final_file |
| Forum Sponsor | ||
|
|
|
|||
|
Thanks Jim!
I know this technique already. I am interested in: somecommand file* (1 command line if possible no PIPE involve) that will give me the results 1 2 3 4 5 6 7 8 9 10 11 12 13 can awk or some other commands be functioned as paste some how???? Thanks! |
|
|||
|
thanks for the reply but it is not working.
Example: file1 cat file1 1 file2 cat file2 2 3 file3 cat file3 3 4 awk '{l[FNR]=l[FNR] $0 OFS} FNR>max {max=FNR} END {for (i=1;i<=max;i++){print l[i]}}' file* result show nothing try it with nawk nawk '{l[FNR]=l[FNR] $0 OFS} FNR>max {max=FNR} END {for (i=1;i<=max;i++){print l[i]}}' file* results: 1 2 3 3 4 I need the data: 1 2 3 3 4 Any takers???? Thanks! |
|
|||
|
i know how to use paste. I can't paste more then 12 files or more. That is why I tried to see any one have other solustions.
nawk '{l[FNR]=l[FNR] $0 OFS} FNR>max {max=FNR} END {for (i=1;i<=max;i++){print l[i]}}' file* this command is not working |
|
|||
|
Try this:
Code:
awk '
FNR==1 { col++ }
FNR>max { max=FNR }
{ l[FNR,col]=$0 }
END {
for (i=1;i<=max;i++) {
for (j=1;j<=col;j++) {
printf "%-10s",l[i,j]
}
print ""
}
}
' file*
|
|||
| Google The UNIX and Linux Forums |