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
MERGE(1)						      General Commands Manual							  MERGE(1)

NAME
merge - three-way file merge SYNOPSIS
merge [ options ] file1 file2 file3 DESCRIPTION
merge incorporates all changes that lead from file2 to file3 into file1. The result ordinarily goes into file1. merge is useful for com- bining separate changes to an original. Suppose file2 is the original, and both file1 and file3 are modifications of file2. Then merge combines both changes. A conflict occurs if both file1 and file3 have changes in a common segment of lines. If a conflict is found, merge normally outputs a warning and brackets the conflict with <<<<<<< and >>>>>>> lines. A typical conflict will look like this: <<<<<<< file A lines in file A ======= lines in file B >>>>>>> file B If there are conflicts, the user should edit the result and delete one of the alternatives. OPTIONS
-A Output conflicts using the -A style of diff3(1), if supported by diff3. This merges all changes leading from file2 to file3 into file1, and generates the most verbose output. -E, -e These options specify conflict styles that generate less information than -A. See diff3(1) for details. The default is -E. With -e, merge does not warn about conflicts. -L label This option may be given up to three times, and specifies labels to be used in place of the corresponding file names in conflict reports. That is, merge -L x -L y -L z a b c generates output that looks like it came from files x, y and z instead of from files a, b and c. -p Send results to standard output instead of overwriting file1. -q Quiet; do not warn about conflicts. -V Print 's version number. DIAGNOSTICS
Exit status is 0 for no conflicts, 1 for some conflicts, 2 for trouble. IDENTIFICATION
Author: Walter F. Tichy. Manual Page Revision: 1.1; Release Date: 1999/04/23. Copyright (C) 1982, 1988, 1989 Walter F. Tichy. Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert. SEE ALSO
diff3(1), diff(1), rcsmerge(1), co(1). BUGS
It normally does not make sense to merge binary files as if they were text, but merge tries to do it anyway. GNU
1999/04/23 MERGE(1)
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy