Sponsored Content
Top Forums Shell Programming and Scripting Results of "find" to an array Post 302265078 by Franklin52 on Friday 5th of December 2008 02:26:25 PM
Old 12-05-2008
If you want to use the array outside of the loop you must avoid to pipe the result. The pipe mechanism starts a subshell and parent shells don't inherit variables of a child shell.

Code:
TARGET="MyRoot"
START_PATH="/Users/rtipton/Desktop/"

PATH_COUNT=0

for result in "`find "$START_PATH" -type d \( -iname "$TARGET" \) \;`"
do
  PATH_RESULTS[$PATH_COUNT]="$result"
  echo "${PATH_RESULTS[$PATH_COUNT]}"
  # more code
  #
  let PATH_COUNT=PATH_COUNT+1
done

Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep to find content in between curly braces, "{" and "},"

problem String ~~~~~~~~~~~~~~~~~~ icecream= { smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" } aend = {smart vc4 eatr kalu} output needed ~~~~~~~~~~~~~~~~~~ smart peopleLink "good" LC "happy" , smartpeopleLink "dull" LC "sad" smart vc4... (4 Replies)
Discussion started by: keshav_rk
4 Replies

2. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

3. Shell Programming and Scripting

Error to "find" a matching array element in a directory

Hi, I have defined an array which holds a couple of elements which are nothing but files names. I want to find the files in a directory for the matching file name(array elements) with less than 1 day old. When I am trying to execute the code (as below), it gives an error. Your help in this... (1 Reply)
Discussion started by: mkbaral
1 Replies

4. Programming

C: Initialize "const" array from the "heap"

Hello, I am working on solving an NP-Complete problem, so it is very important that operations and data with limited integer-argument ranges be computed using immutable look-up-tables contained entirely in CPU cache. Retrieval of the look-up-table data must never leave the CPU once initially... (6 Replies)
Discussion started by: HeavyJ
6 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

7. Shell Programming and Scripting

Awk find in columns with "if then" statement and print results

I have a file1.txt file1.txt F-120009210","Felix","U-M-F-F-F-","white","yes","no","U-M-F-F-F-","Bristol","RI","true" F-120009213","Fluffy","U-F-","white","yes","no","M-F-","Warwick","RI","true" U-120009217","Lity","U-M-","grey","yes","yes","","Fall River","MA","true"... (4 Replies)
Discussion started by: charles33
4 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. Shell Programming and Scripting

find . -path "*_nobackup*" -prune -iname "*.PDF" \( ! -name "*_nobackup.*" \)

These three finds worked as expected: $ find . -iname "*.PDF" $ find . -iname "*.PDF" \( ! -name "*_nobackup.*" \) $ find . -path "*_nobackup*" -prune -iname "*.PDF" They all returned the match: ./folder/file.pdf :b: This find returned no matches: $ find . -path "*_nobackup*" -prune... (3 Replies)
Discussion started by: wolfv
3 Replies

10. Shell Programming and Scripting

Search file containing ps results for a match "my.cnf" and then for a second match . "ok:" and

I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for: my.cnf /bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies
SEQSORT(1e)						     EMBOSS Manual for Debian						       SEQSORT(1e)

NAME
seqsort - Remove ambiguous classified sequences from DHF files. SYNOPSIS
seqsort -dhfindir directory -overlap integer -dofamilies toggle -doambiguities toggle -dhfoutdir outdir -hitsfile outfile -ambigfile outfile seqsort -help DESCRIPTION
seqsort is a command line program from EMBOSS ("the European Molecular Biology Open Software Suite"). It is part of the "Protein:3D Structure" command group(s). OPTIONS
Input section -dhfindir directory This option specifies the location of DHF files (domain hits files) (input). A 'domain hits file' contains database hits (sequences) with domain classification information, in the DHF format (FASTA or EMBL-like). The hits are relatives to a SCOP or CATH family and are found from a search of a sequence database. Files containing hits retrieved by PSIBLAST are generated by using SEQSEARCH. Default value: ./ Required section -overlap integer This option specifies the number of overlapping residues required for merging of two hits. Each family is also processed so that ovlerapping hits (hits with identical accesssion number that overlap by at least a user-defined number of residues) are replaced by a hit that is produced from merging the two overlapping hits. Default value: 10 -dofamilies toggle This option specifies to write a domain families file. If this option is set a domain families file is written. Default value: N -doambiguities toggle This option specifies whether to write a domain ambiguities file. If this option is set a domain ambiguities file is written. Default value: N Output section -dhfoutdir outdir This option specifies the location of DHF files (domain hits files) (output). A 'domain hits file' contains database hits (sequences) with domain classification information, in the DHF format (FASTA or EMBL-like). The hits are relatives to a SCOP or CATH family and are found from a search of a sequence database. Files containing hits retrieved by PSIBLAST are generated by using SEQSEARCH. Default value: ./ -hitsfile outfile This option specifies the name of domain families file (output). A 'domain families file' contains sequence relatives (hits) for each of a number of different SCOP or CATH families found from searching a sequence database, e.g. by using SEQSEARCH (psiblast). The file contains the collated search results for the indvidual families; only those hits of unambiguous family assignment are included. Hits of ambiguous family assignment are assigned as relatives to a SCOP or CATH superfamily or fold instead and are collated into a 'domain ambiguities file'. The domain families and ambiguities files are generated by using SEQSORT and use the same format as a DHF file (domain hits file). Default value: fam.dhf -ambigfile outfile This option specifies the name of domain ambiguities file (output). A 'domain families file' contains sequence relatives (hits) for each of a number of different SCOP or CATH families found from searching a sequence database, e.g. by using SEQSEARCH (psiblast). The file contains the collated search results for the indvidual families; only those hits of unambiguous family assignment are included. Hits of ambiguous family assignment are assigned as relatives to a SCOP or CATH superfamily or fold instead and are collated into a 'domain ambiguities file'. The domain families and ambiguities files are generated by using SEQSORT and use the same format as a DHF file (domain hits file). Default value: oth.dhf BUGS
Bugs can be reported to the Debian Bug Tracking system (http://bugs.debian.org/emboss), or directly to the EMBOSS developers (http://sourceforge.net/tracker/?group_id=93650&atid=605031). SEE ALSO
seqsort is fully documented via the tfm(1) system. AUTHOR
Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.org> Wrote the script used to autogenerate this manual page. COPYRIGHT
This manual page was autogenerated from an Ajax Control Definition of the EMBOSS package. It can be redistributed under the same terms as EMBOSS itself. DOMSEARCH 0.1.0++20100721 08/11/2010 SEQSORT(1e)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy