The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to merge these two files? fedora Shell Programming and Scripting 3 02-12-2008 06:45 PM
merge files koti_rama Shell Programming and Scripting 5 12-24-2007 10:59 PM
use of sed over cat to merge files miwinter UNIX for Advanced & Expert Users 2 11-28-2007 01:36 PM
How to merge files lestat_ecuador Shell Programming and Scripting 3 06-07-2007 07:45 AM
Using NAWK to merge two files madhunk Shell Programming and Scripting 7 06-07-2006 11:27 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-24-2006
u263066 u263066 is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 66
help in merge files

I have created these files in a particular directory
a_1.txt
a_2.txt
...
..
a_n.txt

Each file has a single line.

I want to write a output file a.txt, which will have concantated value of string from all the files.

which utility should i use. copy, cat or paste????

Can anyone help me for this shell script for this.
thanks a ton in advance.
reagrds
vin
  #2 (permalink)  
Old 07-24-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
$ cat a_*.txt | tr -d '\n' > a.txt
  #3 (permalink)  
Old 07-24-2006
u263066 u263066 is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 66
cat does working ...

can i use
paste

As i found the final output will have all string in appended form.

But , I want to concantate the string which is in stone alone file into a single string.
  #4 (permalink)  
Old 07-24-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
can you post an example of what you want to have in result?
  #5 (permalink)  
Old 07-24-2006
u263066 u263066 is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 66
Angry merge file

i have file like :
file_1.txt
file_2.txt
file_3.txt
...
...
file_n.txt

and each file have one string (similar nature)
File_1.txt
111
file_2.txt
222
file_3.txt
333
....
file_n.txt
nnn


following the above example
I want a output file as file.txt and string inthe file should be
11122233334444....nnn

How to do this through script...ie first checking into folder ie how many files subfile exist and then merge a master file out of child file.

thanks a ton in advance
anand
  #6 (permalink)  
Old 07-24-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
but why not

$ cat file_*.txt | tr -d '\n' > file.txt

this will give 11122233334444....nnn
Closed Thread

Bookmarks

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:56 PM.


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