Cat files based on file name


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cat files based on file name
# 1  
Old 09-17-2014
Cat files based on file name

Bros,

I have list of files
Code:
20140916_registeredshop.csv
20140916_datavisit.csv
20140915_registeredshop.csv
20140915_datavisit.csv
20140914_registeredshop.csv
20140914_datavisit.csv
20140913_registeredshop.csv
20140913_datavisit.csv
20140912_registeredshop.csv
20140912_datavisit.csv

I want to join those files into 2 seperated files

My expected output
Code:
datavisit.txt

Code:
registeredshop.txt

I did this
Code:
cat 2014*_datavisit* > datavisit.txt

Code:
cat 2014*_registered* > registeredshop.txt

---------- Post updated at 05:32 AM ---------- Previous update was at 05:24 AM ----------

sorry guys, so hesitated posting this one
suddenly I found the solution,
pardon me
# 2  
Old 09-17-2014
Hello radius,

Could you please try following.

Code:
find -type f -name "*registeredshop.csv" | xargs  cat >> registeredshop.txt
find -type f -name "*datavisit.csv" | xargs cat >> datavisit.txt

Thanks,
R. Singh
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cat files listed in text file and redirect to new directory with same filename

I have a directory that is restricted and I cannot just copy the files need, but I can cat them and redirect them to a new directory. The files all have the date listed in them. If I perform a long listing and grep for the date (150620) I can redirect that output to a text file. Now I need to... (5 Replies)
Discussion started by: trigger467
5 Replies

2. UNIX for Dummies Questions & Answers

CAT multiple files according to file name

I have a folder that contains a number of files with file names as follows: XX.YYYY..ZZZ.2014.001.000000 XX.YYYY..ZZZ.2014.001.000400 XX.YYYY..ZZZ.2014.001.000800 XX.YYYY..ZZZ.2014.001.001200 XX.YYYY..ZZZ.2014.001.001600 ..... XX.YYYY..ZZZ.2014.002.000000 XX.YYYY..ZZZ.2014.002.000400... (8 Replies)
Discussion started by: quakesrus
8 Replies

3. Shell Programming and Scripting

How to concatenate the files based upon the file name?

Hi Experts, I am trying to merge multiple files into one file based upon the file name. Testreport_Server1.txt ============ MonitoringReport_Server1.txt============ CentralReport_Server1 Here two files containing server1 should be merged into one file? How can i do... (16 Replies)
Discussion started by: sharsour
16 Replies

4. Shell Programming and Scripting

Moving files based on file name

Hi All, I have multiple files in the folder, I want to move those files into the other folder on based of name File names: Template_server1_01==> Template_server1_02==>To one directory /Server1 Template_server1_03==> Template_server2_01==> Template_server2_02==>To one... (9 Replies)
Discussion started by: sharsour
9 Replies

5. Shell Programming and Scripting

How to split file into multiple files using awk based on 1 field in the file?

Good day all I need some helps, say that I have data like below, each field separated by a tab DATE NAME ADDRESS 15/7/2012 LX a.b.c 15/7/2012 LX1 a.b.c 16/7/2012 AB a.b.c 16/7/2012 AB2 a.b.c 15/7/2012 LX2 a.b.c... (2 Replies)
Discussion started by: alexyyw
2 Replies

6. Shell Programming and Scripting

Split a file into multiple files based on first two digits of file.

Hi , I do have a fixedwidth flatfile that has data for 10 different datasets each identified by the first two digits in the flatfile. 01 in the first two digit position refers to Set A 02 in the first two digit position refers to Set B and so on I want to genrate 10 different files from my... (6 Replies)
Discussion started by: okkadu
6 Replies

7. Shell Programming and Scripting

grep and cat based on specific mod date

I'm trying to figure out how to open and copy all contents of files last modded on aug 14 to one single text file. Also, I'm trying to do this in one command string. I have ls -l -R | grep "Aug 1" but all this does is print the -l info with Aug 1 in it. how can I modify this so that ls... (3 Replies)
Discussion started by: mmixology
3 Replies

8. Shell Programming and Scripting

.sh script / Check for file in two directories then cat the files

Hi, Here is what i'm trying to do, -Check in two directories for a user inputed filename -Then cat all the version found of the file to the current screen I am a total nembie to programming, here what i have done so far.... #!/bin/bash #Check in /home/loonatic and /var/named/master... (2 Replies)
Discussion started by: Loonatic
2 Replies

9. Shell Programming and Scripting

cat certain files in directories to files named after the dir?

Hi all, I have a directory with many subdirectories each named like so: KOG0001, KOG0002, ...KOG9999. Each of these subdirectories contain a variable number two kinds of files (nuc and prot) named like so: Capitella_sp_nuc_hits.fasta (nuc) and Capitella_sp_prot_hits.fasta (prot). The... (2 Replies)
Discussion started by: kmkocot
2 Replies

10. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies
Login or Register to Ask a Question