AminetAminet
Search:
84716 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/batch/from.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:Best foreach type command ever
Author:Thomas.Radtke at rz.uni-osnabrueck.de
Uploader:Thomas Radtke rz uni-osnabrueck de
Type:util/cli
Architecture:m68k-amigaos
Date:1996-04-04
Download:http://aminet.net/util/batch/from.lha - View contents
Readme:http://aminet.net/util/batch/from.readme
Downloads:562

'from' is a non-standart, AmigaDOS friendly 'foreach' implementation.
The from command will execute a specified command for every line of a given
input source (file or stdin). 'from' is freeware (C) Thomas Radtke 1996.
C Source code included.

Syntax: from <list|-> <command> [args]
'-' is treated as stdin.

The following _local_ variables will be generated for each line of list:

0	command name
i	where i=1..n and n is the number of words in the line
row	actual row in the list (Note: first line is 0, not 1)

You can access the variables in the usual way, i.e. $row,$0,$1,..

Examples:

(1) dircmp2 -i -p -c bin: c: | from - delete $1
	Deletes all identical files from directory bin. Hey, don't
	try to automatically remove things, this is only an example, ok ?
	(unless you have a reliable undel program ;)

(2) from mass_output move $1 waste:mass.$row
	moves all files from the mass_output list to waste: as
	mass.0, mass.1,... (this could be temporary files from somewhere)

(3) from mass_output type $1 >>join_them_together
	mass-join operation of files from the list

Although 'from' is superior to 'foreach', it doesn't allow any internal
filtering of the input lines (e.g. wildcards, refer to -x,-X options in
dircmp2). I think this is obsolete here, since filtering can be done through
'edit' or 'sed' in a better way.

Reference:

dircmp2
-------
The dircmp2 command can be found on Aminet as dircmp2a2.lha (also on CD11?).
An older UN*X version exist in dircmp2.lha.

foreach
-------
There is at least one other foreach type command on Aminet, but is is
buggy and has invalidated my HD.

move
----
The move command can be found in various versions on Aminet
(imo best bet is move110.lha, also on Set1,CD A)

sed
---
Beside the GNU binutils, you will find 'sed' on Aminet as ixemul-free
port.

Implementation notes:
---------------------
(i)	The binary was compiled from from.c with the Aminet version of
gcc 2.7.0 and libnix v1.0 static library.

(ii)	I am using 'from' successfully on my A4000/EC30/882/2+4/3.0.
You must have at least the dos library V36 (2.0?) to get this to work.
You will not enjoy the processing speed with a M68k CPU.

If you like this program, drop me a letter.

Thomas


Contents of util/batch/from.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                 7941   15460  51.4% -lh5- f5f8 Apr  2  1996 from/from
[generic]                  770    1725  44.6% -lh5- 286f Apr  2  1996 from/from.c
[generic]                 1254    2350  53.4% -lh5- 9669 Apr  2  1996 from/from.readme
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         3 files    9965   19535  51.0%            Apr  4  1996

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>