The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Splitting input files into multiple files through AWK command arund_01 Shell Programming and Scripting 3 05-13-2008 09:17 AM
Find duplicates from multuple files with 2 diff types of files ricky007 Shell Programming and Scripting 2 03-04-2008 01:46 PM
unzip particular gzip files among the normal data files thepurple Shell Programming and Scripting 4 11-30-2007 11:17 AM
when I try to run rm on multiple files I have problem to delete files with space umen UNIX for Dummies Questions & Answers 1 09-20-2005 03:20 AM
text files, ASCII files, binary files and ftp transfers Perderabo Answers to Frequently Asked Questions 0 04-08-2004 04:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-10-2008
tjmannonline tjmannonline is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 91
Merg files

i have:

file1 contains: 123abc
file2 contains: 123 abc

i used:

paste file1 file2 > file3, and the output looks like this:

123abc 123 abc

i used:

cat file3 | awk '{print $1, $2}' > file4, result: 123abc 123

my intention is to get file looks like this:

123abc123 abc

when i use paste, it merges columns, but it put space. i want pasted each file, but i don't want any space.
  #2 (permalink)  
Old 05-11-2008
frozentin frozentin is offline
Registered User
  
 

Join Date: May 2008
Location: Vienna, VA + Bombay, India
Posts: 109
Since I don't know awk much, I suggest using sed

cat file3 | sed 's/ //g'
  #3 (permalink)  
Old 05-11-2008
frank_rizzo frank_rizzo is offline Forum Advisor  
Resident BOFH
  
 

Join Date: Dec 2007
Posts: 425
how about this.

Code:
paste -d \0 file1 file2
  #4 (permalink)  
Old 05-11-2008
matrixmadhan matrixmadhan is online now Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Quote:
Originally Posted by frozentin View Post
Since I don't know awk much, I suggest using sed

cat file3 | sed 's/ //g'
beware of UUOC
  #5 (permalink)  
Old 05-11-2008
matrixmadhan matrixmadhan is online now Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
one more,

Code:
awk 'BEGIN{ORS=" "}{ print }END{ printf"\n" }' file1 file2
  #6 (permalink)  
Old 05-11-2008
frozentin frozentin is offline
Registered User
  
 

Join Date: May 2008
Location: Vienna, VA + Bombay, India
Posts: 109
Quote:
Originally Posted by matrixmadhan View Post
beware of UUOC
Point noted.
  #7 (permalink)  
Old 05-11-2008
tjmannonline tjmannonline is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 91
paste and awk worked perfectly.

sed worked, but i did not want to delete a certain space.

again, you guys are GURU, and thank you very much.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux, solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0