how to add the lines of differnt files in a single file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to add the lines of differnt files in a single file
# 1  
Old 10-06-2011
how to add the lines of differnt files in a single file

My question is

I am finding the new.txt file in the directory
I am finding current.txt file in the directory in 2nd time
I am finding fallback.txt in the directory in 3rd time

all with find command

now my question is

let suppose I got all threee files in one directory then I want that output goes into one file and it format shoud be
e.g:
nitin new.txt current.txt fallback.txt {nitin should not display htree time because all three files in same directory}

and if any one file miss(all above three) then that should not comes in final file
# 2  
Old 10-06-2011
use
Code:
cat file1 file2 file3 >> final_file.txt

# 3  
Old 10-06-2011
its append the line in a file

stp2int1 app stpbatch new.txt
stp2int4 web tag new.txt
stp2perf4 app stpmon new.txt
stp2int1 app stpbatch cuurent.txt
stp2int4 web tag new.txt
stp2perf4 app stpmon fallback.txt
stp2int1 app stpbatch fallback.txt
stp2int4 web tag new.txt
stp2perf4 app stpmon fallback.txt


see here stp2int1 has all three files so it should come in the final file and rest of all has missed one file from three so that shuld not come in the final file


its like stp2int1 app stpbatch new.txt current.txt fallback.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Paste 2 single column files to a single file

Hi, I have 2 csv/txt files with single columns. I am trying to merge them using paste, but its not working.. output3.csv: flowerbomb everlon-jewelry sofft steve-madden dolce-gabbana-watchoutput2.csv: http://www1.abc.com/cms/slp/2/Flowerbomb http://www1.abc.com/cms/slp/2/Everlon-Jewelry... (5 Replies)
Discussion started by: ajayakunuri
5 Replies

2. Shell Programming and Scripting

Single command to create multiple empty files(no trailing lines as well).

Hi, i need a single command to create multiple empty files(no trailing lines as well) and empty the files if already existing. please let me know or if this has been ansered, if some ocan share the link please, thanks > newfile.txt or :> newfile.txt do not work (4 Replies)
Discussion started by: Onkar Banerjee
4 Replies

3. UNIX for Dummies Questions & Answers

Need help combining txt files w/ multiple lines into csv single cell - also need data merge

:confused:Hello -- i just joined the forums. I am a complete noob -- only about 1 week into learning how to program anything... and starting with linux. I am working in Linux terminal. I have a folder with a bunch of txt files. Each file has several lines of html code. I want to combine... (2 Replies)
Discussion started by: jetsetter
2 Replies

4. Shell Programming and Scripting

[Solved] Need to add Single quotes to particular lines

Hi Guys, I have the following file. DbName=DBNAME DbUser=USERID DbPass=PASSLL SrcLocation=/appl/data/VSTAR SrcFile1=gmb_dly_ind_sls_20120410133424.txt SrcFile2= IpLocation=/appl/data/VSTAR/global_daily/input/GMB IpFile=gmb_dly_ind_sls_20120410133424.txt... (4 Replies)
Discussion started by: mac4rfree
4 Replies

5. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

6. Windows & DOS: Issues & Discussions

Windows mass copy files with same name in differnt folders

I have files existing with same names in the folders with date as display below c:\2010-09-10 <==== folder arr1.jpg arr2.jpg arr3.jpg arr4.jpg c:\2010-09-09 <==== folder arr1.jpg arr2.jpg c:\2010-09-08 <==== folder arr2.jpg arr3.jpg arr4.jpg ... (5 Replies)
Discussion started by: jville
5 Replies

7. Shell Programming and Scripting

Split the single file lines into multiple files

Let's assume that I have a file name called ‘A' and it has 100 lines in it and would like to split these 100 lines into 4 files as specified bellow. INPUT: Input file name A 1 2 3 4 5 6 7 8 9 ........100 Output: 4 output files (x,y,z,w) File x should contains (Skip 4 lines)... (15 Replies)
Discussion started by: subbarao25
15 Replies

8. Shell Programming and Scripting

Add two lines in a single string

Dear All, I want to add two lines in single string. Example: String1: God Bless You. String2: Thank You. Now i want to store these two above lines into a single string(str) and when i will echo it, it should be like > echo $str God Bless You. Thank You. Please help me. Thanks in... (1 Reply)
Discussion started by: umesh.rout
1 Replies

9. Shell Programming and Scripting

How to merge different coulmn of differnt files

hello gurus , i want to merge different column from two different file. file struture is below. file 1 ------- ~information is given Name class section A 5 b B 7 C D 8 A file 2 (10 Replies)
Discussion started by: rahul sharma11
10 Replies

10. Shell Programming and Scripting

Dividing single file by lines?

Hi, I have a situation where I need to append specific lines to a series of files only when specific lines are found. I can do this using sed -f, however because of the byte limitation for a sedscr file, I create multiple sedscr files (of 180 lines each due to the length of the strings) and do... (1 Reply)
Discussion started by: anoc
1 Replies
Login or Register to Ask a Question