The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Dummy need help :( sabercats Shell Programming and Scripting 8 03-12-2006 02:31 AM
Unix Dummy quarmenna UNIX for Dummies Questions & Answers 3 11-15-2005 04:38 PM
Using dummy files TRUEST UNIX for Advanced & Expert Users 4 04-04-2003 04:23 PM
Dummy Needs Help amygdala UNIX for Dummies Questions & Answers 4 08-31-2001 11:14 PM
Real Dummy here!! Keith UNIX for Dummies Questions & Answers 2 02-06-2001 02:18 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 04-18-2008
smolgara smolgara is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 4
How to insert dummy columns

Hi

My requirement is as follows,

I have a input feed coming for X as

A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;


any other feed coming from Y is as

A,B,C,D,1,2,E,F,G,H,I,J,3,4,5,K,L,M,6,7,8,N,O,P

Now I want to merge both the feed and make the output as
A,B,C,D,0,0,E,F,G,H,I,J,0,0,0,K,L,M,0,0,0,N,O,P X
A,B,C,D,1,2,E,F,G,H,I,J,3,4,5,K,L,M,6,7,8,N,O,P Y

Any suggestions......

Regards,
SM
  #2 (permalink)  
Old 04-19-2008
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
As far as i can see the result consists only of the second feed with all the numerical values set to zero. Maybe i misunderstood your requirement.

To set all the fields consisting of numerical values to "0" use the following sed filter:

Code:
sed 's/[0-9][0-9]*,/0,/g'
I hope this helps.
  #3 (permalink)  
Old 04-19-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,723
By merge do you mean read in both lines and then sort the output horizontally?
Here is an awkward try:
Code:
awk '{
           FILENAME=="file1" { arr[FNR]=$0 }
           FILENAME=="file2" { arr[FNR]= arr[FNR] " " $0}
        }
        END for (in in arr) { print arr[i]} ' file1  file2 | \
while read str
do
 echo $str | tr " " "\n" | sort | tr "\n" " "
 echo
done  > newfile
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:00 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