I have a script that puts a list of files in two separate arrays:
First, I get a file list from a ZIP file and fill `FIRST_Array()` with it. Second, I get a file list from a control file within a ZIP file and fill `SECOND_Array()` with it
Code:
while read length date time filename
do
FIRST_Array+=( "$filename" )
echo "$filename" >> FIRST.report.out
done < <(/usr/bin/unzip -qql AAA.ZIP |sort -k12 -t~)
What shell are you using? I'm not familiar with a redirection operator of the form:
Code:
< <(command pipeline)
Sorry. Never mind. It is a bash feature. This form is not available in ksh and is an extension to the POSIX shell.
ksh88 and ksh93 both support that construct. The process substitution, <(cmd ...) is replaced with /dev/fd/n, and the first < is the usual input redirection operator.
ksh88 and ksh93 both support that construct. The process substitution, <(cmd ...) is replaced with /dev/fd/n, and the first < is the usual input redirection operator.
Regards,
Alister
That's interesting. The ksh on Mac OS X Lion (Version M 1993-12-28 s+ $) says:
Quote:
-ksh: syntax error: `<(' unexpected
when given the command:
Code:
while read line;do echo x $line;done < <(printf "a\nb c\nd e f\n")
The New Kornshell Command and Programming Language book by Nolsky and Korn does say that Process Substitution using this form is a "Possible Extension" that
Quote:
is available only on versions of the UNIX system that support the /dev/fd directory for naming open files.
and OS X does support /dev/fd. It looks like someone at Apple failed to configure OS X's ksh to give us access to this feature.
Hi Guru,
I need some help regarding awking the output so it only show the first line (based on column) of each row.
So If column has 1, three row, then it only show the first line of that row, based on similar character in column 1. So i am trying to achieve a sort, based on column one and... (3 Replies)
Input file:
100%ABC2 3.44E-12 USA
A2M%H02579 0E0 UK
100%ABC2 5.34E-8 UK
100%ABC2 3.25E-12 USA
A2M%H02579 5E-45 UK
Output file:
100%ABC2 3.44E-12 USA
100%ABC2 3.25E-12 USA
100%ABC2 5.34E-8 UK
A2M%H02579 0E0 UK
A2M%H02579 5E-45 UK
Code try:
sort -k1,1 -g -k2 -r input.txt... (2 Replies)
How do you combine these ls commands so that I can have the outputs by name, time stamp, and size?
ls -al |grep name_of_file
ls -al | sort +4nr
ls -l -t
Please advise. (4 Replies)
Hello all,
I have a file - 12.txt
cat 12.txt
===============================================
Number of executions = 2 Total execution time (sec.ms) = 0.009883
Number of executions = 8 Total execution time (sec.ms) = 0.001270
Number of... (23 Replies)
Hi ,
I would like to list or sort by date and time (the files are named in day and time format) where the latest file will be placed at the bottom and the earliest file be placed at the top. Can anybody help me?
My files are named in the following manner.
EG: abc_071128_144121_data
"... (21 Replies)