How to add add some files together and then paste


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to add add some files together and then paste
# 1  
Old 08-30-2010
How to add add some files together and then paste

How can you efficiently add pairs of files together and then paste those pairs,

I have a climate computer at work which spits out temperatures and stuff out twice a day, one for the day-data and one for the night (basically). Every week I want to make a nice overview

The text files are something like this "[date] day.txt" and "[date] night.txt" x7
How would I nicely do this in one bashline?
so:
$cat 2010-08-30\ day.txt 2010-08-30\ night.txt
gives me one day, now paste for a whole week. Can this be done without for loops and such? I really have the feeling I'm overlooking a very simple solution here.
# 2  
Old 08-31-2010
without loop, why?

Code:
find . -type -name "*day.txt" |while read LINE
do
  D=$(echo $line|awk '{print $1}')
  cat "$file" "$D night.txt" > $D.txt
done

With that, you can get one day txt file.

Not sure how to merge these files by weekly, Others maybe can help you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Paste files of varying lengths

I have three files of varying lengths and different number of columns. How can I paste all three with all columns aligned? File1 ---- 123 File2 ---- 234 345 678 File3 ---- 456 789 Output should look like: 123 234 456 345 789 (6 Replies)
Discussion started by: Un1xNewb1e
6 Replies

2. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies

3. Shell Programming and Scripting

paste mutiple files in a loop

file1.txt file2.txt file3.txt desired output is each file is in the same directory, hasthe same number of columns but different rows. i want to be able to paste them into one file. thanks! (5 Replies)
Discussion started by: johnkim0806
5 Replies

4. Shell Programming and Scripting

Paste second columns from files to its corresponding file

Hi All, I have two sets of files. One set with extension .txt This set has file names with numbers like these. 1.txt, 2.txt, 3.txt until extactly 100.txt. The .txt files look like these: 0.38701788 93750 0.38622013 94456 0.38350296 94440 0.38282126 94057 0.38282126 94439 0.35847232... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

5. Shell Programming and Scripting

Editing files to add some thing in all the files in a folder

Hi All, I have a folder that contains 100's of files and each file have a similar content like the following format: ((STBJa:200.0,((STBTz:200.0,(STSwe:200.0,(STDUw:200.0,(ST4Bu:200.0,STL2b:200.0):127.0):86.0):80.0):120.0, STAHr:200.0):134.0):200.0,STuNg:200.0);What I need is to do is add "#1"... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

6. Shell Programming and Scripting

Paste the files

Dear All, I have thousands of files (consists of one column each) and i need to paste all the columns in a single file as follows: I have files - file1, file2, file3, .......file2000. I need to paste all the files in a single file of separate columns as shown below: file1 file2 file3 ... (3 Replies)
Discussion started by: Fredrick
3 Replies

7. UNIX for Dummies Questions & Answers

paste more than 12 files together

Hi, 1. How can I get around the issue with pasting more than 12 files together? 2. paste file1 file2 > file3........how can I do this with awk?? Thanks! (14 Replies)
Discussion started by: bobo
14 Replies

8. Shell Programming and Scripting

paste several files

Hi everybody: I tried to paste several files which have the same pattern name file like this: down_s1.dat, down_s2.dat, down_s3.dat, down_s4.dat ... down_s10.dat So I have tried to do it as: paste down_s.dat > final.dat But it does not work correctly. Any suggestion. Thanks in... (1 Reply)
Discussion started by: tonet
1 Replies

9. UNIX for Dummies Questions & Answers

paste 2 files ( it is possible???)

Hello all, I have two files: file1: data1 data2 data3 data4 data5 data6 data7 data8 data9 file2: reference I need to paste both files with the following output: data1 data2 data3 reference data4 data5 data6 reference data7 data8 data9 reference I tried using the paste... (3 Replies)
Discussion started by: mig28mx
3 Replies

10. Shell Programming and Scripting

Need a Help with paste 2 files since the output is not what i want

Need a Help with paste 2 files since the output is not what i want ie: i have 2 files pwd /home/pavargaz/alejo/scan01/nokia/2006/abril/bavaria/chu0 $ cat filechu chu0 dia Cantidad 01 257 02 262 03 260 04 58 $pwd ... (3 Replies)
Discussion started by: alexcol
3 Replies
Login or Register to Ask a Question