Sponsored Content
Full Discussion: Array question
Top Forums UNIX for Dummies Questions & Answers Array question Post 63244 by thumsup9 on Wednesday 23rd of February 2005 03:41:55 PM
Old 02-23-2005
may be this will help your cause

#!/bin/ksh
#list files
ls -l > file
let i=1
while read file; do
filenames[$i]=$file
let i=$i+1
print $i
done < file
let j=1
while [ $j -le $i ]
do
echo "${filenames[j]}"
let j=$j+1
done
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Storage array question

We just purchased a MOD30 disk array strage system. We have 15 drives and 2 hot spares. We're running a database app with 8 data sets. I'm trying to get the best i/o speed out of my disk configuration. Right now I have 3 raid5 arrays setup. This seems to offer the same performance as having the... (1 Reply)
Discussion started by: ncmurf00
1 Replies

2. Shell Programming and Scripting

Array question

Hi all, I have a question does anyone know if it is possible to push or pop an array in the ksh environment? Could anyone give me a hint, because I am trying to merge 2 server files together and there are some names in the server is not proper anymore. Thank you in advance. (4 Replies)
Discussion started by: ahtat99
4 Replies

3. Shell Programming and Scripting

perl array question from going through hash

suppose my @{$data1{$callid}}; cotains one two three three five six one two three of random patterns but each item is separated by white space or tab, Below code extract and get rid of the whitespace perfectly so that it shows now like this onetwothree threefivesix... (2 Replies)
Discussion started by: hankooknara
2 Replies

4. Shell Programming and Scripting

Variable Sized Array Length Question

I need to implement the following logic and need some expert help from UNIX community. These are the steps in my Shell script. 1. Analyze a file. 2. Extract all the ID's in that file. 3. Use the ID's from #2 to run another filter on the file. I've implemented # 1 and 2 using... (3 Replies)
Discussion started by: katwala
3 Replies

5. Shell Programming and Scripting

Help! Yet another check element in array Question

Greetings, DISCLAIMER: My shell scripting is rusty so my question may be borderline stupid. You've been warned. I need to create a script that a) lists the content of zip files in a directory and b) sends out an `exception` report. My ZIP files contain a control file (for load check). I want... (2 Replies)
Discussion started by: alan
2 Replies

6. Programming

array question

Im new to C programming and am having trouble understanding the output of this code int array={4,5,8,9,8,1,0,1,9,3}; int *array_ptr; int main() { array_ptr=array; while((*array_ptr) != 0) array_ptr++;; printf("%d\n", array_ptr - array); return(0); } the output is 6 but I... (2 Replies)
Discussion started by: sacat
2 Replies

7. UNIX for Dummies Questions & Answers

Array question

I have attempted to create an array consisting of two items: #0 and #1. I am able to print the two items corrctly: arr=(hello "my name is") echo ${arr} hello echo ${arr} my name is However, when I try to run a for loop to print both objects: for i in ${arr } do echo $i done I get:... (2 Replies)
Discussion started by: locoroco
2 Replies

8. Shell Programming and Scripting

Question on iterating array elements

Hi, I am trying to do something similar to the for loop example from KSH For Loop Array: Iterate Through Array Values $: cat y.ksh #!/bin/ksh # set array called nameservers set -A nameservers 192.168.1.1 192.168.1.5 202.54.1.5 # print all name servers for i in ${nameservers} do ... (3 Replies)
Discussion started by: newbie_01
3 Replies

9. Shell Programming and Scripting

Zsh array -a vs. -A question

Inside a zsh function, I create a local array with local -a arrayname and a local associative array with local -A arrayname. I also can create an array using set, like this: set -A arrayname value1 value2 value3In this form, I can not explicitly declare that an array is associative or... (2 Replies)
Discussion started by: rovf
2 Replies

10. Shell Programming and Scripting

Associative array index question

I am trying to assign indexes to an associative array in a for loop but I have to use an eval command to make it work, this doesn't seem correct I don't have to do this with regular arrays For example, the following assignment fails without the eval command: #! /bin/bash read -d "\0" -a... (19 Replies)
Discussion started by: Riker1204
19 Replies
OCAMLDSORT(1)						      General Commands Manual						     OCAMLDSORT(1)

NAME
ocamldsort - Dependency sorter for OCaml source files SYNOPSIS
ocamldsort [ -pp pre-command ] [ -d dep-command ] [ -mli ] [ -nox ] [ -obj | -byte | -opt ] [ filename ] ... DESCRIPTION
The ocamldsort(1) command scans a set of Objective Caml source files (.ml and .mli files), sorts them according to their dependencies and prints the sorted files in order to link their corresponding .cmo files. For ocamldsort(1) to work it must get a list of dependencies generated by ocamldep(1), if the standard input to ocamldsort(1) has been redirected then ocamldsort assumes that this is a dependency file generated by ocamldep(1). Otherwise ocamldsort calls ocamldep(1) to gen- erate the dependency list itself. In either case the source files to be sorted should be given as arguments to the ocamldsort(1) command. ocamldsort(1) can be used to compile and link simple projects with one command, such as: ocamlc $(ocamldsort *.ml) if your project doesn't contain .mli files or: ocamlc -c $(ocamldsort -mli *.ml *.mli) && ocamlc $(ocamldsort -byte *.ml) if it contains .mli files. However for larger projects where separate compilation is desirable, ocamldsort(1) can also be used from within a makefile. Here is a typi- cal makefile example: TARGET=my_program OCAMLC=ocamlc OCAMLOPT=ocamlopt OCAMLDEP=ocamldep OCAMLDSORT=ocamldsort PPFLAGS=-pp camlp4o MLY=$(shell echo *.mly) MLL=$(shell echo *.mll) GENERATED_ML=$(MLY:.mly=.ml) $(MLL:.mll=.ml) include .generated .depend .ocamldsort $(TARGET): $(CMO_FILES) $(OCAMLC) $(COMPFLAGS) $(LIBS) $^ -o $@ $(TARGET).opt: $(CMX_FILES) $(OCAMLOPT) $(COMPFLAGS) $(LIBS_OPT) $^ -o $@ .generated: $(GENERATED_ML) @touch .generated .depend: .generated $(OCAMLDEP) *.ml *.mli > $@ .ocamldsort: .depend echo CMO_FILES=`< .depend $(OCAMLDSORT) -byte *.ml` > .ocamldsort echo CMX_FILES=`< .depend $(OCAMLDSORT) -opt *.ml` >> .ocamldsort distclean: clean rm -f .generated .depend .ocamldsort rm -f $(GENERATED_ML) rm -f *~ rm -f $(TARGET) clean: rm -f *.cmo *.cmi *.cmx *.o .SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly %.cmi:%.mli $(OCAMLC) $(PPFLAGS) $(COMPFLAGS) -c $< %.cmo:%.ml $(OCAMLC) $(PPFLAGS) $(COMPFLAGS) -c $< %.cmi %.cmo:%.ml $(OCAMLC) $(PPFLAGS) $(COMPFLAGS) -c $< %.cmx %.o:%.ml $(OCAMLOPT) $(PPFLAGS) $(COMPFLAGS) -c $< %.ml:%.mll $(OCAMLLEX) $< %.mli %.ml:%.mly $(OCAMLYACC) -v $< OPTIONS
The following command-line options are recognized by ocamlsort(1): -I directory Add the given directory to the list of directories searched for source files. -pp pre-command Command to preprocess file. -d dep-command Command to compute dependencies. ocamldep(1) by default. -mli Sort files using mli dependencies. -nox Ignore filenames containg `*' so that unexpanded wildcards are ignored. -obj Print bytecode filenames (.cmo and .cmi) (deprecated: use -byte). -byte Print bytecode filenames (.cmo and .cmi). -opt Print opt filenames (.cmx and .cmi). -v Output version information and exit. -help, --help Output help and exit. SEE ALSO
ocamldep(1). OCAMLDSORT(1)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy