Copy contain file to end another file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy contain file to end another file
# 1  
Old 01-15-2015
Linux Copy contain file to end another file

Hi All,

How I can paste contain big file1 to end another file2, e.g.,

Code:
$cat file1
aaaaa
bbbbb
ccccc

Code:
$cat file2
11111 22222 3333 4444
55555 66666 7777 8888

then want like

paste contain file1 to end file2 > file3

Code:
$cat file3
aaaaa
bbbbb
ccccc
11111 22222 3333 4444
55555 66666 7777 8888

Thanks you,

Last edited by aav1307; 01-16-2015 at 12:29 PM.. Reason: Add CODE and ICODE tags.
# 2  
Old 01-15-2015
concatenate files:
ty this - you have line from file2 thenlines from file1 in a new file file3
Code:
cat file2 file1 > file3

# 3  
Old 01-16-2015
Hello aav1307,

Following may also help you in same.
Code:
cat file{1,2} > OUTPUT_file   ##In Bash, ksh, zsh

OR
Code:
awk '1' file1 file2 > OUTPUT_file
OR
awk '1' file{1,2} > OUTPUT_file   ##In Bash, ksh, zsh

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 4  
Old 01-16-2015
Or (if your input files really do have the same base name and have literal 1 and 2 at the ends of their names) in any shell that is based on Bourne shell syntax:
Code:
cat file[12] > file3

# 5  
Old 01-16-2015
Excelent Smilie
Quote:
Originally Posted by RavinderSingh13
Hello aav1307,

Following may also help you in same.
Code:
cat file{1,2} > OUTPUT_file   ##In Bash, ksh, zsh

OR
Code:
awk '1' file1 file2 > OUTPUT_file
OR
awk '1' file{1,2} > OUTPUT_file   ##In Bash, ksh, zsh

Thanks,
R. Singh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep a log file starting from a specific time to the end of file

I have a log file which have a date and time at the start of every line. I need to search the log file starting from a specific time to the end of file. For example: Starting point: July 29 2018 21:00:00 End point : end of file My concern is what if the pattern of `July 29 2018 21:00:00`... (3 Replies)
Discussion started by: erin00
3 Replies

2. UNIX for Beginners Questions & Answers

Copy filepath along with filename at end of another file

Hi , Please help me out for the below problem - I have 2 files in a directory - $ ls -ltr total 4 -rwx------+ 1 abc Domain Users 615 May 31 17:33 abc.txt -rwx------+ 1 abc Domain Users 0 May 31 17:33 ll.sh I want to write the filename of abc.txt along with the directory to the... (2 Replies)
Discussion started by: Pratik4891
2 Replies

3. Shell Programming and Scripting

Append orginal file date to end of file

Trying to process 1000 or so files. Take original date and append to end of file. Like so: tstpls42.bas tstpls42.bas.Sep-11--2011 Been working along these lines: date=`ll tstpls42.bas |cut -c 46-57 |sed -e 's/]/\-/g' | grep -v '^$'` for i in *.bas ; do j=`ll $i /hpdump/b1 | awk... (1 Reply)
Discussion started by: joeadmin
1 Replies

4. Shell Programming and Scripting

How to extract start/end times from log file to CSV file?

Hi, I have a log file (log.txt) that which contains lines of date/time. I need to create a script to extract a CSV file (out.csv) that gets all the sequential times (with only 1 minute difference) together by stating the start time and end time of this period. Sample log file (log.txt) ... (7 Replies)
Discussion started by: Mr.Zizo
7 Replies

5. Shell Programming and Scripting

Want it to read the file name and then append date stamp at the end of file?

I was thinking something like for i in `find . -name "*.log.Z"`; do mv $i name.log.Z or something like that? (3 Replies)
Discussion started by: xgringo
3 Replies

6. Shell Programming and Scripting

Change the file name and copy old file content to new file names.

Hi, I have a files in a directory as below :- ls -1 mqdepth-S1STC02 proc-mq-S1STC01 proc-mq-S1STC02 proc-mq-S1STC03 Whereever i have S1STC i need to copy them into new file with file name S2STC. expected output :- ls -1 mqdepth-S2STC02 proc-mq-S2STC01 proc-mq-S2STC02... (3 Replies)
Discussion started by: satishmallidi
3 Replies

7. UNIX for Dummies Questions & Answers

Add strings from one file at the end of specific lines in text file

Hello All, this is my first post so I don't know if I am doing this right. I would like to append entries from a series of strings (contained in a text file) consecutively at the end of specifically labeled lines in another file. As an example: - the file that contains the values to be... (3 Replies)
Discussion started by: gus74
3 Replies

8. Shell Programming and Scripting

Add end of char \n on end of file

Hi, I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this? when I use command echo "1\n" > a.txt and od -c a.txt 0000000 1 \n \n 0000003 How does it differentiate \n and eof in this case? Regards, Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies

9. Shell Programming and Scripting

Append to end of each line of file without a temp file.

Hello I am trying to append an incrimenting number to the end of each line I have it working with a temp file. But I want to do this without a temp file. a=1 cat "file" | while read LINE do echo "$LINE, $a" >> filewithnumbers a=`expr $a + 1` ... (4 Replies)
Discussion started by: rorey_breaker
4 Replies

10. Shell Programming and Scripting

Append a field to the end of each line of a file based on searching another file.

Hi All, I have two comma separated value(CSV) files, say FileA and FileB. The contents looks like that shown below. FileA EmpNo,Name,Age,Sex, 1000,ABC,23,M, 1001,DES,24,F, ... (2 Replies)
Discussion started by: ultimate
2 Replies
Login or Register to Ask a Question