Sponsored Content
Full Discussion: For Loop Taking Too Long
Top Forums Shell Programming and Scripting For Loop Taking Too Long Post 302331534 by hanie123 on Monday 6th of July 2009 01:01:35 PM
Old 07-06-2009
For Loop Taking Too Long

I'm new from UNIX scripting. Please help.
I have about 10,000 files from the $ROOTDIR/scp/inbox/string1 directory to compare with the 50 files from /$ROOTDIR/output/tma/pnt/bad/string1/ directory and it takes about 2 hours plus to complete the for loop. Is there a better way to re-write the script below so it can process faster.
Thank you in advance.

Code:
pntcnt1=`ls -l /$ROOTDIR/scp/inbox/string1 | grep 'PNT.*' | awk '/^-/ {print $9}' | wc -l`
if [[ $pntcnt1 -gt 0 ]] then
 
for gfile in `ls -1 /$ROOTDIR/scp/inbox/string1/PNT.2*`
 do
   gline=`sed '1q' $gfile`
   x=`echo "$gline" | awk '{ print substr( $0, 38, 9 ) }'`
   for bfile in `ls -1 /$ROOTDIR/output/tma/pnt/bad/string1/PNT.2*`
    do
      bline=`sed '1q' $bfile`
      y=`echo "$bline" | awk '{ print substr( $0, 38, 9 ) }'`
if [ "$x" -eq "$y" ]
then
  echo "file moved $gfile"
  mv $gfile /$ROOTDIR/output/tma/pnt/bad/string1
 
break
fi
 
done
 
done
fi

 

10 More Discussions You Might Find Interesting

1. Red Hat

login process taking a long time

I'm having a bit of a login performance issue.. wondering if anyone has any ideas where I might look. Here's the scenario... Linux Red Hat ES 4 update 5 regardless of where I login from (ssh or on the text console) after providing the password the system seems to pause for between 30... (4 Replies)
Discussion started by: retlaw
4 Replies

2. UNIX for Advanced & Expert Users

Comparison and For Loop Taking Too Long

I'd like to 1. Check and compare the 10,000 pnt files contains single record from the /$ROOTDIR/scp/inbox/string1 directory against 39 bad pnt files from the /$ROOTDIR/output/tma/pnt/bad/string1 directory based on the fam_id column value start at position 38 to 47 from the record below. Here is... (1 Reply)
Discussion started by: hanie123
1 Replies

3. Shell Programming and Scripting

<AIX>Problem in purge script, taking very very long time to complete 18.30hrs

Hi, I have here a script which is used to purge older files/directories based on defined purge period. The script consists of 45 find commands, where each command will need to traverse through more than a million directories. Therefore a single find command executes around 22-25 mins... (7 Replies)
Discussion started by: sravicha
7 Replies

4. UNIX for Dummies Questions & Answers

gref -f taking long time for big file

grep -f taking long time to compare for big files, any alternate for fast check I am using grep -f file1 file2 to check - to ckeck dups/common rows prsents. But my files contains file1 contains 5gb and file 2 contains 50 mb and its taking such a long time to compare the files. Do we have any... (10 Replies)
Discussion started by: gkskumar
10 Replies

5. UNIX for Dummies Questions & Answers

Job is taking long time

Hi , We have 20 jobs are scheduled. In that one of our job is taking long time ,it's not completing. If we are not terminating it's running infinity time actually the job completion time is 5 minutes. The job is deleting some records from the table and two insert statements and one select... (7 Replies)
Discussion started by: ajaykumarkona
7 Replies

6. Solaris

Re-sync Taking Extremely Long.

It's almost 3 days now and my resync/re-attach is only at 80%. Is there something I can check in Solaris 10 that would be causing the degradation. It's only a standby machine. My live system completed in 6hrs. (9 Replies)
Discussion started by: ravzter
9 Replies

7. Solaris

How to find out bottleneck if system is taking long time in gzip

Dear All, OS = Solaris 5.10 Hardware Sun Fire T2000 with 1 Ghz quode core We have oracle application 11i with 10g database. When ever i am trying to take cold backup of database with 55GB size its taking long time to finish. As the application is down nobody is using the server at all... (8 Replies)
Discussion started by: yoojamu
8 Replies

8. UNIX for Dummies Questions & Answers

ls is taking long time to list

Hi, All the data are kept on Netapp using NFS. some directories are so fast when doing ls but few of them are slow. After doing few times, it becomes fast. Then again after few minutes, it becomes slow again. Can you advise what's going on? This one directory I am very interested is giving... (3 Replies)
Discussion started by: samnyc
3 Replies

9. Shell Programming and Scripting

While loop problem taking too long

while read myhosts do while read discovered do echo "$discovered" done < $LOGFILE | grep -Pi "|" | egrep... (7 Replies)
Discussion started by: SkySmart
7 Replies

10. Shell Programming and Scripting

Rm -rf is taking very long, will it timeout?

I have so many (hundreds of thousands) files and directories within this one specific directory that my "rm -rf" command to delete them has been taking forever. I did this via the SSH, my question is: if my SSH connection times out before rm -rf finishes, will it continue to delete all of those... (5 Replies)
Discussion started by: phpchick
5 Replies
gacutil(Mono 1.0)														 gacutil(Mono 1.0)

NAME
gacutil - Global Assembly Cache management utility. SYNOPSIS
gacutil [-user] [command] [options] DESCRIPTION
gacutil is a tool used by developers to install versioned assemblies into the system Global Assembly Cache (GAC) to become part of the assemblies that are available for all applications at runtime. Notice that they are not directly available to the compiler. The convention is that assemblies must also be placed in a separate directory to be accessed by the compiler. This is done with the -package directive to gacutil. The tool allows for installation, removal, and listing of the contents of the assembly cache. The GAC is relative to the Mono installation prefix: mono_prefix/lib/mono. COMMANDS
-i <assembly_path> [-check_refs] [-package NAME] [-root ROOTDIR] [-gacdir GACDIR] Installs an assembly into the global assembly cache. <assembly_path> is the name of the file that contains the assembly manifest The -package option can be used to also create a directory in in prefix/lib/mono with the name NAME, and a symlink is created from NAME/assembly_name to the assembly on the GAC. This is used so developers can reference a set of libraries at once. The -root option is used to specify the "libdir" value of an installation prefix which differs from the prefix of the system GAC. Typical automake usage is "-root $(DESTDIR)$(prefix)/lib". To access assemblies installed to a prefix other than the mono prefix, it is necessary to set the MONO_GAC_PREFIX environment variable. The -gacdir option is included for backward compatibility but is not recommended for new code. Use the -root option instead. The -check_refs option is used to ensure that the assembly being installed into the GAC does not reference any non strong named assemblies. Assemblies being installed to the GAC should not reference non strong named assemblies, however the is an optional check. -l [assembly_name] [-root ROOTDIR] [-gacdir GACDIR] Lists the contents of the global assembly cache. When the <assembly_name> parameter is specified only matching assemblies are listed. -u <assembly_display_name> [-package NAME] [-root ROOTDIR] [-gacdir GACDIR] Uninstalls an assembly from the global assembly cache. <assembly_display_name> is the name of the assembly (partial or fully qualified) to remove from the global assembly cache. If a partial name is specified all matching assemblies will be uninstalled. As opposed to the install option that takes a filename, this takes as an argument the assembly name, which looks like this: MyLibrary.Something, version=1.0.0.0, publicKeyToken=xxxx,culture=neutral Notice that you can have spaces in the command line. There is no need to quote them. Performs a greedy removal. If you only specify one component like, "MyLibrary.Something", it will remove all versions of the library. -us <assembly_path> [-package NAME] [-root ROOTDIR] [-gacdir GACDIR] Uninstalls an assembly using the specified assembly's full name. <assembly path> is the path to an assembly. The full assembly name is retrieved from the specified assembly if there is an assembly in the GAC with a matching name, it is removed. Unlike the -u option this option takes a file name, like this: Example: -us myDll.dll -ul <assembly_list_file> [-package NAME] [-root ROOTDIR] [-gacdir GACDIR] Uninstalls one or more assemblies from the global assembly cache. <assembly_list_file> is the path to a test file containing a list of assembly names on separate lines. Example -ul assembly_list.txt assembly_list.txt contents: assembly1,Version=1.0.0.0,Culture=en,PublicKeyToken=0123456789abcdef assembly2,Version=2.0.0.0,Culture=en,PublicKeyToken=0123456789abcdef FILES
On Unix assemblies are loaded from the installation lib directory. If you set `prefix' to /usr, the assemblies will be located in /usr/lib. On Windows, the assemblies are loaded from the directory where mono and mint live. /etc/mono/config, ~/.mono/config Mono runtime configuration file. See the mono-config(5) manual page for more information. WEB SITE
Visit: http://www.go-mono.com for details SEE ALSO
mcs(1),mono(1) gacutil(Mono 1.0)
All times are GMT -4. The time now is 02:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy