how assign the O/p of find command to a list.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how assign the O/p of find command to a list.
# 8  
Old 04-06-2010
something like this:
Code:
co=0
find . -name "application.env" | while read LIST
do
a[co]=`grep "login_name" $LIST| cut -d = -f2`
b[co]=`grep "password" $LIST| cut -d = -f2`
c[co]=`grep "host" $LIST| cut -d = -f2`
co=`expr co + 1`
done

Now , the arrays a,b,c will have the details of the usernames , passwords and host details etc.
# 9  
Old 04-06-2010
my intension is to take the O/P of find commad into list not the contents of application.env

say

find . -name "application.env"

returns

usr1/app/application.env
usr1/app/application/application.env
usr1/app/application/update/application.env

The above results i have to keep it in a list and i have to loop for the result of application.env resides in application folder.Thats it.

Thanks for you response.
# 10  
Old 04-06-2010
Then , it will be like this:

Code:
co=0
find . -name "application.env" |
 while read LIST
do
a[$co]=`echo $LIST`
echo ${a[co]};
co=`expr $co + 1`
done

Now the array "a" have the paths of all the env files , so you can go through them to do your task.
# 11  
Old 04-06-2010
Thanks a lot this is my first shell script its working my problem got resolved.

Thanks & Regards
Dinesh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find command to find a word from list of files

I need to find a word '% Retail by State' in the folder /usr/sas/reports/RetailSalesTaxallocation. When I tried like below, -bash-4.1$ cd /usr/sas/reports/RetailSalesTaxallocation -bash-4.1$ find ./ -name % Retail by State find: paths must precede expression: Retail Usage: find ... (10 Replies)
Discussion started by: Ram Kumar_BE
10 Replies

2. Shell Programming and Scripting

List last 1 hour files with out FIND command

Hi Friends, Can we have an alternate command to list last 1hour files with out FIND command? Thanks Suresh (6 Replies)
Discussion started by: suresh3566
6 Replies

3. UNIX for Dummies Questions & Answers

List versus find command

Hi, My OS is SunOS mymac1 5.10 Generic_148888-04 sun4v sparc SUNW,SPARC-Enterprise-T5220 When i cd /var/output ls -ltr *.css It yields the output in less than a second. While find /var/output -type f -name "*.css" does not complete for a while. and find /var/output -type f *.css... (13 Replies)
Discussion started by: mohtashims
13 Replies

4. UNIX for Dummies Questions & Answers

Code to list the files of find command

hi, i want to list the files from the below find commands output. find ./* -name "*.txt" -type f -mtime +10 will give the output like ./a.txt but i need the output in the format like (ls -lrt a.txt ) -rw-rw-rw- 1 srea nast 5 May 23 07:34 a.txt i used xargs for the... (4 Replies)
Discussion started by: msathees
4 Replies

5. Shell Programming and Scripting

How to list the files based on the modification time using the find command?

Hi All, I need to list the files based modification time of the files from a directory, I cannot use "ls -t" as there are lot of files, which "ls" command cannot handle. New files will land there daily. So iam looking for an alternative through "find"command. All suggestions are welcomed. ... (6 Replies)
Discussion started by: Kesavan
6 Replies

6. UNIX for Dummies Questions & Answers

Help - Find command with list of files modified descending Order

Hi, I would like to know the command to get the files order in descending order with "FIND" command. Appreciate your help Thanks (4 Replies)
Discussion started by: TonySolarisAdmi
4 Replies

7. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

8. Shell Programming and Scripting

Help with find command and list in a long format each found file

The purpose of those comands are to find the newest file in a directory acvrdind to system date, and it has to be recursively found in each directory. The problem is that i want to list in a long format every found file, but the commands i use produce unexpected results ,so the output lists in a... (5 Replies)
Discussion started by: alexcol
5 Replies

9. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies

10. UNIX for Dummies Questions & Answers

solaris2.6 command to find/list system configuration

Hi. What command can be used to determine the system configuration. For example I want to find out how much CPU, how much memory, what CPU and 233mhz or 400mhz, etc. Please help.... (4 Replies)
Discussion started by: subhransu
4 Replies
Login or Register to Ask a Question