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.
# 1  
Old 04-06-2010
how assign the O/p of find command to a list.

i want to take the o/p of find command into a list like in java. can anyone help me regarding this.
# 2  
Old 04-06-2010
Pls Post the input and expected output.

Thanks and Regards
Ravi
# 3  
Old 04-06-2010
i will explain with the scenario
Ex:

find . -name "application.env"

which will results in more than one location.In this case i need to take it as a list.

so my intenstion is to get the O/P of find command into list.
# 4  
Old 04-06-2010
Dinesh,

Some thing like this are you expecting ?

Code:
 
unset a
find . -name "application.env" | while read LIST
do
a[$co]=$LIST
co=`expr $co + 1`
done
tput bold
echo ${#a[@]}
for i in ${a[@]}
do
printf "     %s\n" "$i"
done

# 5  
Old 04-06-2010
Similar to the code .i tried it but not working.
# 6  
Old 04-06-2010
pls post,

Pls specify clearly the output expected ( any thing you want to do in unix).
# 7  
Old 04-06-2010
Thanks for your response.i am having the "application.env" in more than one location in the server

so i am using the find command to get the locations of application.env

file_name=$(find . -name "application.env");


grep "login_name" $file_name| cut -d = -f2

Here in the above command i nedd to put the application.env file path from application folder .

Sample application.env
=================

login_name=abc
password=abc
host=XYZ
...........etc

Last edited by dineshmurs; 04-06-2010 at 08:56 AM..
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