Routing the world

Routing & IT System Administration

Merge two files line by line and strip tabs

leave a comment »

If you want to merge two files line by line you can use the next code:

cat file1 | paste - | paste file2 -

This code will insert a tab between the lines for each file, if you need to strip the tab you can use:

tr -d ' \ 011'

So, the final result will be:

cat file1 | paste - | paste file2 - | tr -d ' \ 011'

Advertisements

Written by Root

December 11, 2011 at 13:43

Posted in Linux

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: