LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2013, 05:03 AM   #1
secret
LQ Newbie
 
Registered: Mar 2013
Posts: 9

Rep: Reputation: Disabled
awk join 2 files


Hi im afraid this is fairly simple, but all answers I find are way too complicated for this problem.
I have 2 files of the same type.

Input:
File1:

1 bla bla bla
2 bla bla bla
3 bla bla bla

File2:

4 bla bla bla
5 bla bla bla

I want something like

Output:

1 bla bla bla
2 bla bla bla
3 bla bla bla
4 bla bla bla
5 bla bla bla

Thx for the help.
 
Old 05-15-2013, 05:20 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
looks like a simple sort.
cat file1 file2 | sort > result
 
Old 05-15-2013, 05:25 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Even simply
Code:
~$ cat file1 file2
Will do the job.
 
Old 05-15-2013, 06:45 AM   #4
secret
LQ Newbie
 
Registered: Mar 2013
Posts: 9

Original Poster
Rep: Reputation: Disabled
Great thank you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk - how to join the string with calculated values kcapple Programming 15 05-15-2013 03:25 AM
[SOLVED] Pass search results to awk, and use awk output to search other files bspears1 Linux - Newbie 8 07-21-2012 09:17 AM
join 3 files mierdatuti Programming 7 01-07-2009 02:19 PM
join two iso files kdrlx Linux - Software 3 12-07-2006 12:39 AM
Join two mpeg2/4 ts files gjagadish Linux - Software 1 09-08-2006 02:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration