For loop and read from different directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting For loop and read from different directories
# 8  
Old 08-14-2017
Also paste reads the input files (here: the ls commands) in round robin order:
Code:
paste -d '\n' <( ls A/ ) <( ls B/ ) <( ls C/ )

Empty lines might occur if an input file is exhausted; you can discard them with
Code:
paste -d '\n' <( ls A/ ) <( ls B/ ) <( ls C/ ) | grep .

These 2 Users Gave Thanks to MadeInGermany For This Post:
# 9  
Old 08-15-2017
Hello,
I am sorry for my delayed return
I will test it tomorrow and keep you posted about the result


Thanks
Boris

---------- Post updated 08-15-17 at 02:27 PM ---------- Previous update was 08-14-17 at 07:07 PM ----------

Hello MadeInGermany,
This is what I wish to accomplish!

Here is the output:

Code:
root@localhost:/home/ubuntu# paste -d '\n' <( ls 1/ ) <( ls 2/ ) <( ls 3/ )
aa
11
xx
bb
22
yy
cc
33
zz

Thank you so much for your help!


Kind regards
Boris
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies

2. Shell Programming and Scripting

Accessing multiple directories in loop

Hi Guys, I need to access multiple directories whcih is following similar structure and need to copy those files in desitination path. for eg : if ] then cd ${DIR}/Mon/loaded echo "copying files to $GRS_DIR" cp * ${DIR}/Mon/ echo "Files of Monday are Copied" fi if ] then... (5 Replies)
Discussion started by: rohit_shinez
5 Replies

3. UNIX for Dummies Questions & Answers

Read statement within while read loop

hi, this is my script #!/bin/ksh cat temp_file.dat | while read line do read test if ]; then break else echo "ERROR" fi done when i execute this code , the script does wait for the user input . it directly prints "ERROR" and terminates after the no. of times as there... (3 Replies)
Discussion started by: siva1612
3 Replies

4. Shell Programming and Scripting

To read directories and file

Hi ; I want to write a shell script to read all files and directories(recursively) given in path along with their user permissions and store that result in one file as File path Userpermissions ===== =========== I m new to linux and my dont kno much abt shell scripting. I will... (5 Replies)
Discussion started by: ajaypadvi
5 Replies

5. Shell Programming and Scripting

For Loop Range Create Directories

Hello, I am a bit stumped on this. I am attempting to create 24 empty directories with a loop. Seems like I have incorrect syntax. When I run the following command I get the error below. Command $ for i in {2..24}; do mkdir $i_MAY_2011 ; doneError x 24 mkdir: missing operand Try `mkdir... (2 Replies)
Discussion started by: jaysunn
2 Replies

6. Shell Programming and Scripting

Loop to move files in different directories

Hi, I have various log files in different paths. e.g. a/b/c/d/e/server.log a/b/c/d/f/server.log a/b/c/d/g/server.log a/b/c/h/e/server.log a/b/c/h/f/server.log a/b/c/h/g/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log and above these have an archive folder... (6 Replies)
Discussion started by: acc01
6 Replies

7. Shell Programming and Scripting

Newbie: How to loop round sub-directories

I want a bit of shell script that will let me loop round all the sub-directories in a directory (i.e. ignoring any ordinary files in that directory). Let's say I just want to echo the names of the sub-directories. This sounds like it should be pretty easy - but not for me, it isn't! All help... (4 Replies)
Discussion started by: cjhancock
4 Replies

8. Shell Programming and Scripting

How to loop through directories to touch files

Hi, Please help me on this. Suppose i have the following directory structure. /app/data /app/data/eng /app/data/med /app/data/bsc each of the directories data,data/eng,data/med,data/bsc holds files with date extension like a.20081230 b.20081230 and so on I need a script to loop... (9 Replies)
Discussion started by: sussane
9 Replies

9. Shell Programming and Scripting

Script to loop through all files and directories.

I'm trying to write a script that will loop through all files and directories down from a path I give it, and change the permissions and ACL. I was able to do the obvious way and change the files and folders on the same level as teh path...but I need it to continue on deeper into the file... (2 Replies)
Discussion started by: cheetobandito
2 Replies
Login or Register to Ask a Question