Sponsored Content
Top Forums Shell Programming and Scripting Merging two files to form header Post 303012157 by MadeInGermany on Tuesday 30th of January 2018 03:41:07 PM
Old 01-30-2018
Quote:
Originally Posted by disedorgue
Hi,
maybe :
Code:
awk '/^ENTER CREDENTIALS/ { getline line <"file2"} $0=$0" ,"line' file1

But, if you have most block "ENTER CREDENTIALS" that input in file2, the last Blocks will setting with last input of file2.

Regards.
Also I get different behavior with different awk versions. An unsuccessful getline gives different results. Better check its return status.
Some awk versions have a different opinion when a ($0) is true or false. Better do not rely on it.
Code:
awk '{ if (/^ENTER CREDENTIALS/ && getline line <"file2") print ($0 "," line); else print }' file1

or
Code:
awk '/^ENTER CREDENTIALS/ && getline line <"file2" { $0=($0 "," line) } 1' file1

This User Gave Thanks to MadeInGermany For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Changing Unix form to Microsoft Word form to be able to email it to someone.

Please someone I need information on how to change a Unix form/document into a microsoft word document in order to be emailed to another company. Please help ASAP. Thankyou :confused: (8 Replies)
Discussion started by: Cheraunm
8 Replies

2. UNIX for Dummies Questions & Answers

Merging two files

Hi I have a requirement like this. I have two files This is how data1.txt looks: EI3171280 38640658501 NENN2005-12-129999-12-312005-12-12HALL NANCY 344 CHENEY HIGHWAY ... (4 Replies)
Discussion started by: venommaker
4 Replies

3. Shell Programming and Scripting

Want to mv files form one folder to another by date

Hi All Looking for some help here I want to query a file and mv all files that are older than seven days to an archive folder. the archive folder already exists but I am having trouble with the date comparison. list file is as follows eg dd2302071334.txt dd2302071358.txt... (7 Replies)
Discussion started by: SummitElse
7 Replies

4. Shell Programming and Scripting

merging two files

Friends, os: redhat enterprise linux/SCO UNIX5.0 I have two files and I would like to merge on given key value. Now I have tried with join commd but it does not supporte multiple delimiters. and if records length is not fixed. join -a1 5 -a2 1 -t -o file1 file2 > outname Can any... (7 Replies)
Discussion started by: vakharia Mahesh
7 Replies

5. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

6. UNIX for Dummies Questions & Answers

Merging two files

Hi, I have two files a.txt and b.txt. a.txt 1 2 3 4 b.txt a b c d e I want to generate a file c.txt by merging these two file and the resultant file would contain c.txt 1 (4 Replies)
Discussion started by: siba.s.nayak
4 Replies

7. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

8. Shell Programming and Scripting

Merging two files

Hi All , I have a scenario where we need to combine two files . Below are the sample files and expected output , File 1: 1|ab 1|ac 1|ae 2|ad 2|ac File 2: 1|xy 1|fc 2|gh 2|ku Output file : 1|ab|xy (3 Replies)
Discussion started by: saj
3 Replies

9. UNIX for Dummies Questions & Answers

Dynamically merging 2 files on header values

Hi All, I have 2 files which i need to merge together based on the column names provided in the file. The first line in both files are header records. The first file has fixed columns but second file can have subset of the columns from file 1 File 1: ... (6 Replies)
Discussion started by: kushagra
6 Replies
REGDIFF(1)							  [FIXME: manual]							REGDIFF(1)

NAME
regdiff - Diff program for Windows registry files SYNOPSIS
regdiff [--help] [--backend=BACKEND] [--backend=BACKEND] [--credentials=CREDENTIALS] [--credentials=CREDENTIALS] [location] [location] DESCRIPTION
regdiff compares two Windows registry files key by key and value by value and generates a text file that contains the differences between the two files. A file generated by regdiff can later be applied to a registry file by the regpatch utility. regdiff and regpatch use the same file format as the regedit32.exe utility from Windows. OPTIONS
--help Show list of available options. --backend BACKEND Name of backend to load. Possible values are: creg, regf, dir and rpc. The default is dir. This argument can be specified twice: once for the first registry file and once for the second. --credentials=CREDENTIALS Credentials to use, if any. Password should be separated from user name by a percent sign. This argument can be specified twice: once for the first registry file and once for the second. VERSION
This man page is correct for version 4.0 of the Samba suite. SEE ALSO
gregedit, regshell, regpatch, regtree, samba, patch, diff AUTHOR
This utility is part of the Samba[1] suite, which is developed by the global Samba Team[2]. This manpage and regdiff were written by Jelmer Vernooij. NOTES
1. Samba http://www.samba.org/ 2. Samba Team http://www.samba.org/samba/team/ [FIXME: source] 04/16/2014 REGDIFF(1)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy