Sponsored Content
Top Forums UNIX for Dummies Questions & Answers CAT multiple files according to file name Post 302912316 by quakesrus on Thursday 7th of August 2014 10:14:45 AM
Old 08-07-2014
CAT multiple files according to file name

I have a folder that contains a number of files with file names as follows:
Code:
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
XX.YYYY..ZZZ.2014.002.000800
XX.YYYY..ZZZ.2014.002.001200
XX.YYYY..ZZZ.2014.002.001600
....

I would like to cat all files XX.YYYY..ZZZ.2014.001.* into one file named XX.YYYY..ZZZ.2014.001, all files XX.YYYY..ZZZ.2014.002.* into one file named XX.YYYY..ZZZ.2014.002.

I am new to the Forums, so apologies if the post ended up in the wrong place.
Thank you for helping.
Cheers


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by vbe; 08-07-2014 at 11:33 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cat'ing a multiple line file to one line

I am writing a script that is running a loop on one file to obtain records from another file. Using egrep, I am finding matching records in file b, then outputing feilds of both into another file. **************************** filea=this.txt fileb=that.txt cat $filea | while read line do... (1 Reply)
Discussion started by: djsal
1 Replies

2. UNIX for Dummies Questions & Answers

cat multiple files questions

Hi-- I'm trying to figure out how to use cat more wisely. I have the following command, which works, but I'd like to understand how to get it to work more clearly and efficiently. cat 'my file.001' 'my file.002' 'my file.003' 'my file.004' 'my file.005' 'my file.006' 'my file.007' 'my... (6 Replies)
Discussion started by: rlinsurf
6 Replies

3. 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

4. Shell Programming and Scripting

bash: cat multiple files together except first line?

Hopefully the title summarized what I need help with. I have multiple files that I would like to concatenate in bash. ie: cat file1 file2 file3 > bigfile except I do not want to include the first line from each file (). Any help? Thanks. (6 Replies)
Discussion started by: sanimfj
6 Replies

5. 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

6. UNIX Desktop Questions & Answers

trying to cat multiple pairs of files

I have a number of files in a directory named like this: fooP1, fooN1, fooP2, fooN2 ... fooP(i), fooN(i). I'd like to know how to combine each P and N pair into a single file, foo(i) TIA John Balwit (1 Reply)
Discussion started by: balwit
1 Replies

7. UNIX for Dummies Questions & Answers

Cat files based on file name

Bros, I have list of files 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 ... (1 Reply)
Discussion started by: radius
1 Replies

8. UNIX for Dummies Questions & Answers

Is there any way to cat multiple files and show filenames?

Hi, Is there any way to do a cat * where it shows the name of each file in the process? Similar to what more does below? $ more ?.sql :::::::::::::: 1.sql :::::::::::::: set linesize 200 select db_unique_name, cast( from_tz( cast(... (5 Replies)
Discussion started by: newbie_01
5 Replies

9. 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

10. UNIX for Beginners Questions & Answers

Merge multiple columns into one using cat

I will like to merge several files using 'cat', but I observe the output is not consistent. the merge begins at the last line of the first file. file1.txt: 1234 1234 1234 file2.txt: aaaa bbbb cccc dddd cat file1.txt file2.txt > file3.txt file3.txt: 1234 1234 1234aaaa bbbb cccc... (13 Replies)
Discussion started by: geomarine
13 Replies
MRO::Compat(3)						User Contributed Perl Documentation					    MRO::Compat(3)

NAME
MRO::Compat - mro::* interface compatibility for Perls < 5.9.5 SYNOPSIS
package FooClass; use base qw/X Y Z/; package X; use base qw/ZZZ/; package Y; use base qw/ZZZ/; package Z; use base qw/ZZZ/; package main; use MRO::Compat; my $linear = mro::get_linear_isa('FooClass'); print join(q{, }, @$linear); # Prints: "FooClass, X, ZZZ, Y, Z" DESCRIPTION
The "mro" namespace provides several utilities for dealing with method resolution order and method caching in general in Perl 5.9.5 and higher. This module provides those interfaces for earlier versions of Perl (back to 5.6.0 anyways). It is a harmless no-op to use this module on 5.9.5+. That is to say, code which properly uses MRO::Compat will work unmodified on both older Perls and 5.9.5+. If you're writing a piece of software that would like to use the parts of 5.9.5+'s mro:: interfaces that are supported here, and you want compatibility with older Perls, this is the module for you. Some parts of this code will work better and/or faster with Class::C3::XS installed (which is an optional prereq of Class::C3, which is in turn a prereq of this package), but it's not a requirement. This module never exports any functions. All calls must be fully qualified with the "mro::" prefix. The interface documentation here serves only as a quick reference of what the function basically does, and what differences between MRO::Compat and 5.9.5+ one should look out for. The main docs in 5.9.5's mro are the real interface docs, and contain a lot of other useful information. Functions mro::get_linear_isa($classname[, $type]) Returns an arrayref which is the linearized "ISA" of the given class. Uses whichever MRO is currently in effect for that class by default, or the given MRO (either "c3" or "dfs" if specified as $type). The linearized ISA of a class is a single ordered list of all of the classes that would be visited in the process of resolving a method on the given class, starting with itself. It does not include any duplicate entries. Note that "UNIVERSAL" (and any members of "UNIVERSAL"'s MRO) are not part of the MRO of a class, even though all classes implicitly inherit methods from "UNIVERSAL" and its parents. mro::import This allows the "use mro 'dfs'" and "use mro 'c3'" syntaxes, providing you "use MRO::Compat" first. Please see the "USING C3" section for additional details. mro::set_mro($classname, $type) Sets the mro of $classname to one of the types "dfs" or "c3". Please see the "USING C3" section for additional details. mro::get_mro($classname) Returns the MRO of the given class (either "c3" or "dfs"). It considers any Class::C3-using class to have C3 MRO even before Class::C3::initialize() is called. mro::get_isarev($classname) Returns an arrayref of classes who are subclasses of the given classname. In other words, classes in whose @ISA hierarchy we appear, no matter how indirectly. This is much slower on pre-5.9.5 Perls with MRO::Compat than it is on 5.9.5+, as it has to search the entire package namespace. mro::is_universal($classname) Returns a boolean status indicating whether or not the given classname is either "UNIVERSAL" itself, or one of "UNIVERSAL"'s parents by @ISA inheritance. Any class for which this function returns true is "universal" in the sense that all classes potentially inherit methods from it. mro::invalidate_all_method_caches Increments "PL_sub_generation", which invalidates method caching in all packages. Please note that this is rarely necessary, unless you are dealing with a situation which is known to confuse Perl's method caching. mro::method_changed_in($classname) Invalidates the method cache of any classes dependent on the given class. In MRO::Compat on pre-5.9.5 Perls, this is an alias for "mro::invalidate_all_method_caches" above, as pre-5.9.5 Perls have no other way to do this. It will still enforce the requirement that you pass it a classname, for compatibility. Please note that this is rarely necessary, unless you are dealing with a situation which is known to confuse Perl's method caching. mro::get_pkg_gen($classname) Returns an integer which is incremented every time a local method of or the @ISA of the given package changes on Perl 5.9.5+. On earlier Perls with this MRO::Compat module, it will probably increment a lot more often than necessary. USING C3 While this module makes the 5.9.5+ syntaxes "use mro 'c3'" and "mro::set_mro("Foo", 'c3')" available on older Perls, it does so merely by passing off the work to Class::C3. It does not remove the need for you to call "Class::C3::initialize()", "Class::C3::reinitialize()", and/or "Class::C3::uninitialize()" at the appropriate times as documented in the Class::C3 docs. These three functions are always provided by MRO::Compat, either via Class::C3 itself on older Perls, or directly as no-ops on 5.9.5+. SEE ALSO
Class::C3 mro AUTHOR
Brandon L. Black, <blblack@gmail.com> COPYRIGHT AND LICENSE
Copyright 2007-2008 Brandon L. Black <blblack@gmail.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2009-05-27 MRO::Compat(3)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy