![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to open program and send/execute command in program | tuathan | UNIX for Dummies Questions & Answers | 1 | 11-19-2008 09:59 PM |
| A program to trace execution of another program | jiten_hegde | High Level Programming | 3 | 08-19-2008 05:26 AM |
| How to write to stdin of another program (program A -> [stdin]program B) | vvaidyan | UNIX for Dummies Questions & Answers | 3 | 08-02-2008 05:21 PM |
| How to write to stdin of another program (program A -> [stdin]program B) | vvaidyan | High Level Programming | 1 | 04-30-2008 01:44 PM |
| executing a program within a program | Gekko | High Level Programming | 4 | 06-27-2002 03:36 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
AWK program
Hi all,
I have the following problem and hope someone could help me. I have 184 files, each with 5 columns (c1, c2, c3, c4, c5). I am only interrested in column 5, and would like to paste column 5 from all the 184 files into one file. I have tried the following with two files awk '{print $5)' file1 file2 | paste -d" " >! a06.txt The above command line does work, but it pastes colum 5 in one column in the new file (a06.txt). I want it to do it side by side, i.e. c5file1 c5file2, instead of c5file1 c5file2 At the end, I expect to have a file with c5file2 c5file2 c5file3....c5file184. Thanks for your help! |
|
||||
|
This smells like homework, but here is some of the answer. First I would set up a loop to go from 1...184 and dump the awk results to a file say 'result.txt'. Next I would use the paste command to put them in your desired format.
But for the way you have listed the problem here is the answer awk '{print $5}' file1 ...... file184>result.txt;paste -s a06.txt |
|
||||
|
not tested but I would would
Code:
awk '{print $5}' file* >> result.txt
What is the "desired" format? |
| Sponsored Links | ||
|
|