![]() |
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 |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
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' |
|
||||
|
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
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|