Sponsored Content
Full Discussion: files cross over
Top Forums Shell Programming and Scripting files cross over Post 302141231 by radoulov on Thursday 18th of October 2007 07:08:34 AM
Old 10-18-2007
As drl suggested (this is the lazy way, you could make f1,f2 ... dynamic if you wish, and use parameter expansion instead of cut):

Code:
zsh 4.3.4% fgrep . file*
file1:f1 01 1.0
file1:f1 02 2.0
file1:f1 03 3.0
file1:f1 04 4.0
file1:f1 05 5.0
file1:f1 06 6.0
file2:f2 01 21.0
file2:f2 02 22.0
file2:f2 03 23.0
file2:f2 04 24.0
file2:f2 05 25.0
file2:f2 06 26.0
file3:f3 01 31.0
file3:f3 02 32.0
file3:f3 03 33.0
file3:f3 04 34.0
file3:f3 05 35.0
file3:f3 06 36.0
zsh 4.3.4% paste -d"\n" <(printf "f1 %s %s %s\n" $(cut -f3 -d" " file1))\
<(printf "f2 %s %s %s\n" $(cut -f3 -d" " file2))\
<(printf "f3 %s %s %s\n" $(cut -f3 -d" " file3))
f1 1.0 2.0 3.0
f2 21.0 22.0 23.0
f3 31.0 32.0 33.0
f1 4.0 5.0 6.0
f2 24.0 25.0 26.0
f3 34.0 35.0 36.0

 

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Cross Posting

In regards to this post: https://www.unix.com/showthread.php?s=&threadid=10372 it may be advisable to inform new members about the repercussions of cross-posting. (9 Replies)
Discussion started by: Karma
9 Replies

2. Shell Programming and Scripting

Cross checking two files

i have two files which contains some fields separated by columns as 03/29/1999 08:48:12 02 172.16.114.50 03/29/1999 09:08:00 480 172.16.112.100 Both of the files do have the same format I want the script which will take two such... (3 Replies)
Discussion started by: vaibhavkorde
3 Replies

3. Shell Programming and Scripting

awk cross-referencing between two files

I need to make my sloppy, existing code (non awk) more efficient and I seem to be terrible with awk :wall: I've tried around quite a bit, maybe you guys can conjure up a quick solution... file1: 2 SOL 563 2 SOL 565 3 SOL 589 2 SOL 603 1 SOL 612 1 SOL 621... (1 Reply)
Discussion started by: origamisven
1 Replies

4. UNIX for Dummies Questions & Answers

Cross complie linux make files onto a windows 7 machine using PGI Cygwin

Hello, I am very unfamiliar with linux/unix (don't even know the difference), but am trying to get some linux software to run on my Windows machine for my research. I have the makefiles for the software, and it is designed to be compiled in the PGI complier, which I also have. When i... (6 Replies)
Discussion started by: roba87
6 Replies

5. Linux

Cross compile

Hi, I'm cross compiling libelektra to arm from linux system its giving library errors can any one help me? (0 Replies)
Discussion started by: Gautham.P
0 Replies

6. Programming

what is a cross compiler

recently i was been to an interview to an automotive company, they have posed me a question that what section of compiler must be changed if the target is changed. ie,if ur compiler is meant for generating executable to a 8051 target what changes do you do to make it flexible to generate the... (2 Replies)
Discussion started by: shyam.sunder91
2 Replies

7. Shell Programming and Scripting

Cross Tab

I need help to do cross tab file input 20160101|ASIA|CHINA|2000 20160101|ASIA|INDIA|3000 20160102|ASIA|CHINA|4000 20160103|ASIA|CHINA|2000 20160103|AFRIKA|ZAMBIA|2000 20160104|ASIA|CHINA|5000 expected output CONTINENT|NATION|20160101|20160102|20160103|20160104... (1 Reply)
Discussion started by: radius
1 Replies
DIFF3(1)						      General Commands Manual							  DIFF3(1)

NAME
diff3 - 3-way differential file comparison SYNOPSIS
diff3 [ -exEX3 ] file1 file2 file3 DESCRIPTION
Diff3 compares three versions of a file, and publishes disagreeing ranges of text flagged with these codes: ==== all three files differ ====1 file1 is different ====2 file2 is different ====3 file3 is different The type of change suffered in converting a given range of a given file to some other is indicated in one of these ways: f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3. f : n1 , n2 c Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1. The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of the lower-numbered file is suppressed. Under the -e option, diff3 publishes a script for the editor ed that will incorporate into file1 all changes between file2 and file3, i.e. the changes that normally would be flagged ==== and ====3. Option -x (-3) produces a script to incorporate only changes flagged ==== (====3). The following command will apply the resulting script to `file1'. (cat script; echo '1,$p') | ed - file1 The -E and -X are similar to -e and -x, respectively, but treat overlapping changes (i.e., changes that would be flagged with ==== in the normal listing) differently. The overlapping lines from both files will be inserted by the edit script, bracketed by "<<<<<<" and ">>>>>>" lines. For example, suppose lines 7-8 are changed in both file1 and file2. Applying the edit script generated by the command "diff3 -E file1 file2 file3" to file1 results in the file: lines 1-6 of file1 <<<<<<< file1 lines 7-8 of file1 ======= lines 7-8 of file3 >>>>>>> file3 rest of file1 The -E option is used by RCS merge(1) to insure that overlapping changes in the merged files are preserved and brought to someone's atten- tion. FILES
/tmp/d3????? /usr/libexec/diff3 SEE ALSO
diff(1) BUGS
Text lines that consist of a single `.' will defeat -e. 7th Edition October 21, 1996 DIFF3(1)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy