Page 1 of 1

Expressing delimiter's in a loop stage??

Posted: Thu Sep 15, 2005 6:32 am
by dh_Madhu
Hi,
In a loop stage I use the list loop option for which I get values by issuing a ls -m command which retrieves a list of files with a comma and SPACE between each file. It also has a New Line character added to it at the end of the fourth file in the list.
File1, File2, File3, File4,
File5, File6, File7, File8

Now how do i specify two different delimiters at the same time for those files which fall at the end??
This has taken a lot of time out of me.
Could I get your valuable inputs pls.
Thanks.

Posted: Thu Sep 15, 2005 6:53 am
by chulett
Technically there's only one delimiter - the comma.

Why do "ls -m" and complicate things? Why not use "ls -1" instead?

Posted: Thu Sep 15, 2005 4:00 pm
by ray.wurlod
Note that the argument to ls here is the numeric "1", not the lower case "L". The "1" option forces output to be one file per line, that is, in a single column. It's the easiest way to get a list of file names to process. You can follow it with any regular expression for filtering the list of file names.

Posted: Thu Sep 15, 2005 7:31 pm
by dh_Madhu
Chulett & Ray,
Yes!
I did try ls -1 and got an output like
File1
File2
File3
File4
.......that was fine but the delimiter '\n' is not being recognised. Is the representation of this carriage return right or is there any other way.
If this works out then that would be excellent.
Thanks.

Posted: Thu Sep 15, 2005 7:59 pm
by ray.wurlod
Line terminators are converted to field marks (@FM) when captured.

Posted: Thu Sep 15, 2005 8:51 pm
by dh_Madhu
I got it.
Thanks a lot Ray.