Re: help for concatenate 2 files
Tim Chase <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On 2013-03-27 15:55, MOKRANI Rachid wrote: > I don't know how to concatenate two files with row. > > The first file is : > cat /tmp/file1 > bug_id ; creation_ts ; bug_severity > 8 ; 2013-03-21 ; N/A > 9 ; 2013-03-21 ; Mineur > 10 ; 2013-03-21 ; Mineur > 11 ; 2013-03-21 ; Mineur > 12 ; 2013-03-25 ; N/A > 13 ; 2013-03-25 ; N/A > > The second file is : > cat /tmp/file2 > bug_id ; bug_when ; added > 9 ; 2013-03-21 15:49:44 ; CONFIRME > 10 ; 2013-03-21 15:04:56 ; CONFIRME > 11 ; 2013-03-21 15:56:59 ; CONFIRME > 12 ; 2013-03-25 17:09:09 ; CONFIRME I'm not sure that's the sort of thing that can be done with sed, but you can use "join" to get pretty close: join --nocheck-order -a 1 --header file1 file2 You might also want to add -t' ' to tweak how it treats the spaces. -tim