however, this method, even if it did work, also has it's own problems - what happens when a new directory is created? it would throw the variable numbering out and i'd get a 'crm' directory appearing in the 'ifid' column.
all solutions greatly appreciated, i love to see diversity, it increases my knowledge of unix.
Let me try - this is my first script - so please be lenient!
I used tmp-files and I think it's not good, probably rs can do the trick. But this script is working. It takes names of directories as arguments (there may be more than 3 arguments) and prints the names of files conlumnwise.
#!/bin/sh
for i in $*
do
echo $i > my_temp_file_$i
ls $i >> my_temp_file_$i
echo my_temp_file_$i >> list_of_temp_files
done
radoulov - thank you, but up until you added the substition "${@##*/}"; your command worked. we only have 'ksh' here and not 'bash/ksh93'.
phystech846 - thank you, but your attempt uses temp files and i was trying to avoid creating files - i find it a bit messy. nice effort though.
Zazzybob - perfect, works a treat - everything lines up nice and straight. thank you. i'm using your attempt, with an extra 'prinf' line for the column titles. see below.
#!/usr/bin/python
import os
a = os.listdir("/test1")
b = os.listdir("/test2")
c = os.listdir("/test3")
for item in map(None,a,b,c):
if item[0] == None: item[0] = ''
if item[1] == None: item[1] = ''
if item[2] == None: item[2] = ''
print "%20s\t%20s\t%20s" % (item[0],item[1],item[2])