The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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 06: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 06:21 PM
How to write to stdin of another program (program A -> [stdin]program B) vvaidyan High Level Programming 1 04-30-2008 02:44 PM
executing a program within a program Gekko High Level Programming 4 06-27-2002 04:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-18-2009
achellstrom achellstrom is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 16
I like it this is much sweeter than my answer, but the way I read it you still need the paste -s. No need for a loop with this. Nice.
  #2 (permalink)  
Old 03-18-2009
aaaaargh aaaaargh is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 20
Quote:
Originally Posted by achellstrom View Post
I like it this is much sweeter than my answer, but the way I read it you still need the paste -s. No need for a loop with this. Nice.
No paste needed.
  #3 (permalink)  
Old 03-18-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,418
Quote:
Originally Posted by aaaaargh View Post
No paste needed.
i think you didn't get his question..
suppose he has two files
file1:
1 2 3 4 5
6 7 8 9 0
1 2 3 4 7

file2:
1 8 2 5 6
1 3 6 7 3
4 2 7 4 6

he want final file as:
5 6
0 3
7 6
  #4 (permalink)  
Old 03-18-2009
awkliker awkliker is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 6
Thank you all for your help!

These two command lines "awk '{print $5}' file1 ...... file184>result.txt;paste -s result.txt > a06.txt" give the following output:
c5file1
c5file2
.
.
.
c5file184

which was what I had before

The format should be as "c5file2 c5file2 c5file3....c5file184", i.e. I need the columns to be side by side.
Thanks again!
  #5 (permalink)  
Old 03-18-2009
aaaaargh aaaaargh is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 20
if you want the columns side by side you can do

Code:
 awk '{printf "%s\t",$0} END '{print}'' file*

  #6 (permalink)  
Old 03-18-2009
awkliker awkliker is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 6
Yes, Vidyadhar85. That's exactly the format I am looking format.
file1:
1 2 3 4 5
6 7 8 9 0
1 2 3 4 7

file2:
1 8 2 5 6
1 3 6 7 3
4 2 7 4 6

he want final file as:
5 6
0 3
7 6

Thanks!
  #7 (permalink)  
Old 03-19-2009
awkliker awkliker is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 6
"' awk '{printf "%s\t",$0} END '{print}'' file* "" This one still does not work.

Thanks!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0