![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Displaying Output in Columns | jjamd64 | Shell Programming and Scripting | 1 | 04-25-2008 06:46 AM |
| CLI Magic: A little script to customize directory listings | iBot | UNIX and Linux RSS News | 0 | 12-11-2007 05:50 AM |
| Displaying files in a directory | markjohnlowe | UNIX for Dummies Questions & Answers | 4 | 03-14-2007 08:58 AM |
| displaying range of columns | mahabunta | Shell Programming and Scripting | 1 | 01-26-2007 05:59 AM |
| displaying directory in html | adel66 | UNIX for Dummies Questions & Answers | 9 | 11-03-2003 09:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
displaying 3 directory listings in 3 separate columns.
i having problems figuring out how to 'read' in 3 different directory listings and then display them on the screen into 3 separate columns.
i thought i could use a 'for' loop to grab each directory and then assign a unique variable to each line 'read' in. of course, as you experts all know, you can't do env$num=$env. an example of the script i had in mind is below. #!/bin/ksh num=0 for env in `ls /mg_apps/crm` `ls /mg_apps/ifid` `ls /mg_apps/riab` do env$num=$env num=`expr $num + 1` done echo "crm" "ifid" "riab" echo $env1 $env4 $env7 echo $env2 $env5 $env8 echo $env3 $env6 $env9 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. cheers. |
|
||||
|
thanks for that. it works, but i didn't want to mess about with creating files and then deleting them.
i also then have to figure out how to get a title at the top of each column and then display in lovely straight lines. e.g. crm ifid crmuat1 ifiduat crmproduction ifiduat2 crmuat2 ifiddev |
|
||||
|
thank you radoulov, but still not quite what i was after.
once i've placed the full path name of crm, ifid or riab in the 'set' command, i get the full path name as a heading, which is a little messy. it's also still not aligned in nice straight columns. see the output below. e.g. /mg_apps/crm /mg_apps/ifid /mg_apps/riab crm_MKS_build ifiddev dev crmdev ifidprd prod crmprd ifiduat uat crmuat reladmin |
|
||||
|
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 pr -m -l 2 `cat list_of_temp_files` for i in $* do rm my_temp_file_$i done rm list_of_temp_files |
![]() |
| Bookmarks |
| Tags |
| bash, bash eval, eval |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|