Since the original filenames are predictable (identical to the containing directory followed by an incrementing index and the .txt extension), we can just build them until we construct one that doesn't exist. There is no need to sort.
The only information any solution to this problem needs to know is the sequence of books and where to find them.
The following script takes two arguments, $1, the path to the old testament books and, $2, the path to the new testament books. The sequence of book names is embedded in the script. The script begins looking for books in the old testament until a blank line in the embedded list signals it to switch to the new testament.
NOTE: Each book's name in the embedded list must be identical to the directory basename ("Genesis" in the case of "/home/your/Desktop/Bible/Old Testament/Genesis"). Same case. Same spacing.
Code:
ot=$1
nt=$2
t=$ot
while IFS= read -r b; do
[ -z "$b" ] && t=$nt && continue
i=1
while cat "$t/$b/$b$i.txt" 2>/dev/null; do
i=$((i+1))
done
done <<'END_OF_DAYS'
Genesis
Exodus
...
Zechariah
Malachi
Matthew
Mark
...
Jude
Revelation
END_OF_DAYS
Note the blank line before Matthew (iirc, beginning of the NT); it's critical.
If the script were stored in a file named bible.sh, the following would generate a single text file bible (using pathnames derived from your posts):
Code:
sh bible.sh ~/Desktop/Old\ Testament ~/Desktop/New\ Testament > bible.txt
Hi there,
I have numerous files in a directory (approx 2500) that I want to delete although I get the following:-
Server> rm *.*
Arguments too long
Is there a proper way of deleting this rather than breaking it down further through the list of files
rm *10.*
rm *11.*
rm *12.*
... (10 Replies)
Hi, I'm totally new to Unix. I'm an MVS mainframer but ran into a situation where a Unix server I have available will help me. I want to be able to remotely connect to another server using FTP, login and MGET all files from it's root or home directory, logout, then login as a different user and do... (1 Reply)
I need a script to concatenate several files in one step, I have 3 header files say file.S, file.X and file.R, I need to concatenate these 3 header files to data files, say file1.S, file1.R, file1.X so that the header file "file.S" will be concatenated to all data files with .S extentions and so on... (3 Replies)
I have 2 files
FILEA
1232342
1232342
2344767
4576823
2325642
FILEB
3472328
2347248
1237123
1232344
8787890
I want the output to go into a 3rd file and look like:
FILEC
1232342 3472328 (1 Reply)
I have directory structure sales_only under which i have multiple directories for each dealer
example:
../../../Sales_Only/xxx_Dealer
../../../Sales_Only/yyy_Dealer
../../../Sales_Only/zzz_Dealer
Every day i have one file produce under each directory when the process runs.
The requirement... (3 Replies)
Hi, I want to create a batch(bash) file to combine 23 files together. These files have the same extension. I want the final file is save to a given folder. Once it is done it will delete the 23 files.
Thanks for help. Need script. (6 Replies)
I have a file named "file1" which has the following data
10000
20000
30000
And I have a file named "file2" which has the following data
ABC
DEF
XYZ
My output should be
10000ABC
20000DEF (3 Replies)
Hi All,
Need your help.
I will need to concatenate around 100 files but each end of the file I will need to insert my name DIRT1228 on each of the file and before the next file is added and arrived with just one file for all the 100files.
Appreciate your time.
Dirt (6 Replies)
Hi
I am trying to learn linux step by step an i am wondering
can i use cat command for concatenate files but i want to place context of file1 to a specific position in file2 place of file 2 and not at the end as it dose on default?
Thank you. (3 Replies)
- 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
LEARN ABOUT DEBIAN
tm::tree
TM::Tree(3pm) User Contributed Perl Documentation TM::Tree(3pm)NAME
TM::Tree - Topic Maps, trait for induced tree retrieval
SYNOPSIS
use TM::Materialized::AsTMa;
my $tm = new TM::Materialized::AsTMa (file => 'old_testament.atm');
Class::Trait->apply ( $tm => 'TM::Tree' );
$tm->sync_in;
# old-testament pedigree
print Dumper $tm->tree (lid => 'adam',
type => 'has-parent',
arole => 'parent',
brole => 'child' );
# new-testament inverse pedigree
print Dumper $tm->tree (lid => 'gw-bush',
type => 'has-parent',
arole => 'child',
brole => 'parent' );
DESCRIPTION
Obviously, topic maps can carry information which is tree structured. A family pedigree is a typical example of it; associations having a
particular type, particular roles and you can derive a tree structure from that.
This is exactly what this operator does: it takes one topic map basis and primed with a starting node, an association type and two roles a
tree will be returned to the caller.
INTERFACE
Methods
tree
$treeref = $tm->tree (
$start_topic,
$type_topic,
$role_topic,
$role_topic,
[ depth => $integer ])
$treeref = $tm->tree_x (
$start_topic,
$type_topic,
$role_topic,
$role_topic,
[ depth => $integer ])
This function will analyze the topic map and will detect all maplets of the given type (direct and indirect ones) having the specified
roles. Starting from the start topic it will so find other topics playing the brole. Those will be used as a next starting point, and
so forth.
To avoid the tree to become too big, you can impose an optional limit. Loops are detected.
Every output tree node contains following fields:
"lid":
the lid of the node
"children":
a list reference of child nodes, there is no specific sort order
"children*":
Note: This is currently deactivated.
for convenience this list reference contains all children, grand-children, grand-grand children.... of this node (this list is
neither sorted nor unique out of performance considerations).
The version "tree_x" does not honor subclassing of roles and type (but "tree" does). This means that is can be considerably faster,
especially if you use it for taxonomy stuff with "isa" and "is-subclass-of".
taxonomy
$treeref = $tm->taxonomy ([ $start_lid ])
This function is a specialization of "tree", in that it looks at a particular association type ("is-subclass-of") and the appropriate
roles ("superclass", "subclass"). Obviously the result is a tree holding all subtypes.
The only optional parameter is a toplet "lid"; that becomes the starting point of the tree. If that parameter is missing, "thing" is
assumed.
SEE ALSO
TM
COPYRIGHT AND LICENSE
Copyright 200[3-6] by Robert Barta, <drrho@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-02-15 TM::Tree(3pm)