Sponsored Content
Top Forums Shell Programming and Scripting building output file from multiple input files Post 302340589 by Franklin52 on Tuesday 4th of August 2009 03:32:04 AM
Old 08-04-2009
It's complicated to do this in one awk command with many arrays, it's more clarifying to split this in more steps:

Code:
awk 'NR==FNR{a[$1];next}
$1 in a
' fileA fileB > temp

awk 'NR==FNR{a[$2]=$0;next}
$1 in a {print a[$1], $2}
' temp fileC > temp1

awk 'NR==FNR{a[$3]=$0;next}
$1 in a {print a[$1], $2}
' temp1 fileD

rm temp temp1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me . Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer. I want to create a mutiple output files with each file having a... (2 Replies)
Discussion started by: bhargavkr
2 Replies

2. Shell Programming and Scripting

How to add data from 2 input files and save it in 1 output file

Hi, i have 2 input files which are file1.txt and file2.txt. I need to extract data from file1.txt and file2.txt and save it in file3.txt like example below:- File1.txt ID scrap1 Name scrap1 start 1 end 10 ID scrap2 Name scrap2 start 11 end ... (4 Replies)
Discussion started by: redse171
4 Replies

3. Shell Programming and Scripting

Split a file into multiple files based on the input pattern

I have a file with lines something like. ...... 123_start ...... ....... 123_end .... ..... 456_start ...... ..... 456_end .... ..... 789_start .... .... 789_end (6 Replies)
Discussion started by: abinash
6 Replies

4. Shell Programming and Scripting

How to ftp multiple files by taking the file name from a input file.

Hi, I'm working on a script which has to copy multiple files from one server to another server. The list of files that are to be copied is present in a file say input.txt. vi input.txt abc.c welcome.c new.c welcome1.c for ftp'ing a single file say 'new.c' the following code... (2 Replies)
Discussion started by: i.srini89
2 Replies

5. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

6. Shell Programming and Scripting

Split: File into multiple and keeping the same 3 lines from input into all output files

The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so: print -n "Enter file name to split? " ; read infile if then echo "Invalid file... (4 Replies)
Discussion started by: mrn6430
4 Replies

7. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

I have a environment property file which contains: Input file: value1 = url1 value2 = url2 value3 = url3 and so on. I need to search all *.xml files under directory for value1 and replace it with url1. Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Discussion started by: Shamkamde
7 Replies

8. Shell Programming and Scripting

[Solved] Multiple input files and output files

Hi, I have many test*.ft1 files to which I want to read as input for a script called pipe2txt.tcl and print the output in each separate file. For example, pipe2txt.tcl < test001.ft1 > test001.txt How can I read many files in this maner? thank you very much, Best, Pahuja (5 Replies)
Discussion started by: Pahuja
5 Replies

9. Shell Programming and Scripting

Copying a file to multiple other files using a text file as input

Hello, I have a file called COMPLIST as follows that contains 4 digit numbers.0002 0003 0010 0013 0015 0016 0022 0023 0024 0025 0027 0030 0031 0032 0033 0035 0038 0041 (3 Replies)
Discussion started by: sph90457
3 Replies

10. Shell Programming and Scripting

Building a dynamic UNIX menu with input files

Hi! I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input. for example, contents of input.txt could be: user1|srv1 user3|srv1 user4|srv1 user2|srv2 I want the menu look like: 1) get password for user1 on srv1 2) get password for user3 on... (7 Replies)
Discussion started by: cpolikowsky
7 Replies
lorder(1)							   User Commands							 lorder(1)

NAME
lorder - find ordering relation for an object or library archive SYNOPSIS
lorder filename... DESCRIPTION
The input is one or more object or library archive filenames (see ar(1)). The standard output is a list of pairs of object file or archive member names; the first file of the pair refers to external identifiers defined in the second. The output may be processed by tsort(1) to find an ordering of a library suitable for one-pass access by ld. Note that the link editor ld is capable of multiple passes over an ar- chive in the portable archive format (see ar.h(3HEAD)) and does not require that lorder be used when building an archive. The usage of the lorder command may, however, allow for a more efficient access of the archive during the link edit process. The following example builds a new library from existing .o files. ar -cr library `lorder *.o | tsort` FILES
TMPDIR/*symref temporary files TMPDIR/*symdef temporary files TMPDIR usually /var/tmp but can be redefined by setting the environment variable TMPDIR (see tempnam() in tmpnam(3C)) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbtool | +-----------------------------+-----------------------------+ SEE ALSO
ar(1), ld(1), tsort(1), tmpnam(3C), ar.h(3HEAD), attributes(5) NOTES
lorder will accept as input any object or archive file, regardless of its suffix, provided there is more than one input file. If there is but a single input file, its suffix must be .o. The length of the filename for TMPDIR is limited to whatever sed allows. SunOS 5.11 29 Oct 1991 lorder(1)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy