Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Copy(append ) the contents of file1 and file2 to file3 Post 302928284 by junior-helper on Wednesday 10th of December 2014 12:51:18 PM
Old 12-10-2014
Quote:
Originally Posted by kraljic
I have multiple log file variables like LOG1 , LOG2, ... declared in my scripts, I guess I will have to change it to what you've suggested If there is no other way
Not sure, I don't know you script and don't know how you want to handle it exactly, but if you wanted to cat files already stored in LOG1 LOG2 and LOG3, (without doing the stunt with LOG I mentioned before), with bash you could try this:
Code:
for i in {1..3}; do
 x=LOG$i
 cat ${!x} >>mySingleLogfile.log
done

I hope this doesn't complicate the situation further Smilie
Quote:
You are not that junior. Are you ? Smilie
Smilie

Edit: Yet another option/variant:
Code:
for i in $LOG1 $LOG2 $LOG3; do
 cat $i >>mySingleLogfile.log
done


Last edited by junior-helper; 12-10-2014 at 02:18 PM..
This User Gave Thanks to junior-helper For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

2. UNIX for Advanced & Expert Users

print contents of file2 for matching pattern in file1 - AWK

File1 row is same as column 2 in file 2. Also file 2 will either start with A, B or C. And 3rd column in file 2 is always F2. When column 2 of file 2 matches file1 column, print all those rows into a separate file. Here is an example. file 1: 100 103 104 108 file 2: ... (6 Replies)
Discussion started by: i.scientist
6 Replies

3. UNIX for Dummies Questions & Answers

cat file1 file2 > file3

file1 has pgap500 500 file2 has bunch of data cat file1 file2 > file3 cp file2 file3.dat then vi pgap500 500 onto 1st line compare file3 and fil3.dat, they are not the same. any idea ? the 1st line, i want to put pg500 xxx ---------- Post updated at 07:35 AM ---------- Previous... (2 Replies)
Discussion started by: tjmannonline
2 Replies

4. Shell Programming and Scripting

append text from file1 to the end of each line in file2

hi; my file2.txt:portname=1;list=10.11;l- portname=2;list=10.12;l- portname=3;list=10.13;l- ... my file1.txt:;"{'sector=%27'}"\&> so; i want to see:portname=1;list=10.11;l-;"{'sector=%27'}"\&> portname=2;list=10.12;l-;"{'sector=%27'}"\&> portname=3;list=10.13;l-;"{'sector=%27'}"\&>... (4 Replies)
Discussion started by: gc_sw
4 Replies

5. UNIX for Dummies Questions & Answers

if matching strings in file1 and file2, add column from file1 to file2

I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string. I'm looking to match column1 in file1 to the number... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

6. Shell Programming and Scripting

Performance issue with fgrep -vf file1 file2>file3

Hi all, My requirement is that i have two files file1 and file2. file1 content is present in file2. i want to have a final which will have file2 contents but not the contents of file1 so I am running below command. fgrep -vf file1 file2>file3 no of records in file1 is 65282 no of records... (10 Replies)
Discussion started by: Lakshman_Gupta
10 Replies

7. Shell Programming and Scripting

awk read in file1, gsub in file2, print to file3

I'm trying to use awk to do the following. I have file1 with many lines, each containing 5 fields describing an individual set. I have file2 which is a template config file with variable space holders to be replaced by the values in file1. I would like to substitute each set of values in file1 with... (6 Replies)
Discussion started by: msmehaffey
6 Replies

8. Shell Programming and Scripting

How to append two files(file1 and file2) Please help me?

Hi I have two files file1 and file2 File1 10,000 entries:It has 3 columns below. conn=232257 client=xxx.xxx.xx.xxx:60491 protocol=LDAP File2 has 500 entries It has two columns. conn=232257 dn="uid=xxxx,ou=xxxx,ou=xxxx,dc=xxxxx,dc=xxxx" conn=232398... (10 Replies)
Discussion started by: buzzme
10 Replies

9. Shell Programming and Scripting

awk or any other means to find IP (File1 / MAC (File2)) entries and putting them on File3

Hi everyone, I would like to complete the following could you please find some time and help me to achieve below: File 1 has a list of IP address (more than 1k) File1:1.1.1.1 2.2.2.2 1.1.1.2 3.3.3.3 2.3.3.2File 2 has content like this:Internet 11.165.91.244 0 Incomplete ... (4 Replies)
Discussion started by: redred
4 Replies

10. Programming

PYTHON COPY Contents of file1 into a specific entry in file2

file1 cat dog fish file2 This is a bunch of lines <!-- INSERT ANIMALS HERE --> horse cheetah post results file2 This is a bunch of lines <!-- INSERT ANIMALS HERE --> cat dog fish horse (1 Reply)
Discussion started by: TY718
1 Replies
LOG2(3) 						     Linux Programmer's Manual							   LOG2(3)

NAME
log2, log2f, log2l - base-2 logarithmic function SYNOPSIS
#include <math.h> double log2(double x); float log2f(float x); long double log2l(long double x); Link with -lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): log2(), log2f(), log2l(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L; or cc -std=c99 DESCRIPTION
The log2() function returns the base 2 logarithm of x. RETURN VALUE
On success, these functions return the base 2 logarithm of x. For special cases, including where x is 0, 1, negative, infinity, or NaN, see log(3). ERRORS
See math_error(7) for information on how to determine whether an error has occurred when calling these functions. For a discussion of the errors that can occur for these functions, see log(3). VERSIONS
These functions first appeared in glibc in version 2.1. CONFORMING TO
C99, POSIX.1-2001. The variant returning double also conforms to SVr4, 4.3BSD. SEE ALSO
cbrt(3), clog2(3), log(3), log10(3), sqrt(3) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2010-09-12 LOG2(3)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy