-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjoin.pl
More file actions
42 lines (30 loc) · 1.05 KB
/
join.pl
File metadata and controls
42 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#----------------------------------------------------
# join.pl
#----------------------------------------------------
# Joins multiple files into single file.
# File contents preceded by a line of the form:
# <START_OF_NEXT_FILE> filename
#
#----------------------------------------------------
#----------------------------------------------------
# Get the names of all the files to combine.
while ( $file_name = <STDIN> ) {
chomp( $file_name ) ;
if ( ( $file_name =~ /[a-z]/ ) && ( $file_name !~ /((^)|(\\))copy /i ) ) {
push( @file_name_list, $file_name ) ;
}
}
#----------------------------------------------------
# For first/next file ...
foreach $file_name ( @file_name_list ) {
# Write labeled filename.
print "<START_OF_NEXT_FILE> " . $file_name . "\n" ;
# Copy all lines.
open( INFILE, $file_name ) ;
while ( $input_line = <INFILE> ) {
chomp( $input_line ) ;
print $input_line . "\n" ;
}
close( INFILE ) ;
# Repeat loop for next file.
}