Sponsored Content
Top Forums Shell Programming and Scripting need inputs on how i can change my script to reduce amount of time the script takes Post 302303079 by JerryHone on Wednesday 1st of April 2009 07:40:05 PM
Old 04-01-2009
For starters...
don't chomp the whole array on every pass through it
don't keep opening and closing the files on each instance of list2

Your model is very confusing - take a good look at the algorithm you've come up with and simplify it.
Store in memory rather than keep opening and closing files and writing to disk.

Hope that helps.

Jerry
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

executing a script for a certain amount of time

I am writing a script that takes two parameters: the name of another script and an integer that represents a number of seconds. The script must execute the second script (first parameter) for the specified number of seconds (second parameter), suspend it for the same number of seconds, and continue... (9 Replies)
Discussion started by: ponchorage
9 Replies

2. Shell Programming and Scripting

shell script takes long time to complete

Hi all, I wrote this shell script to validate filed numbers for input file. But it take forever to complete validation on a file. The average speed is like 9mins/MB. Can anyone tell me how to improve the performance of a shell script? Thanks (12 Replies)
Discussion started by: ozzman
12 Replies

3. UNIX for Dummies Questions & Answers

Help how replace stardard keyboard inputs by arguments at run time of a script

Hello Everybody, Please help. I was trying to automate the use of a third-party given shell script. The script is written to be used at run-time to collect a few variables to be provided by the user through key board, in the fashion as below: ./runcommand please provide a file name to... (6 Replies)
Discussion started by: Dingrong
6 Replies

4. Shell Programming and Scripting

Script that takes in variables, and outputs to another text or script file

Ok, I sort of need to create a command files that will be ftped to another server to run. I have some input variable that will need to be read, and then transformed into another script file. Here are some examples. Server 1: outputCmd.sh passing in ./outputCmd.sh nh8oaxt Release_4_0... (1 Reply)
Discussion started by: orozcom
1 Replies

5. Shell Programming and Scripting

Perl script for taking inputs from one script and storing them into a document.

Hi. I wanted to create a Perl script which can take the outputs of a Perl script as it's input and temporarily store them in a document. Need help. Thanks.:) (8 Replies)
Discussion started by: xtatic
8 Replies

6. Shell Programming and Scripting

Automation script to reduce the installation time

DELETED. (0 Replies)
Discussion started by: vasuvv
0 Replies

7. Shell Programming and Scripting

Need a shell script which takes two inputs and copy the files from one directory to other

Hi, I am using solari 10 OS which is having bash shell. I need a shell script which takes user home directory and name of the file or directory as a input and based on that copy the files accordingly to the other directory. example:I hava a machine1 which is having some files in a... (8 Replies)
Discussion started by: muraliinfy04
8 Replies

8. Shell Programming and Scripting

Script which takes two inputs based on that execute othe scripts

Hi, I am using solaris 10 bash shell.this might a small script but i am not much familiar with scripting. My requirement here is script should prompt for users two opions like this "please select either any one option makefile or make& build file". if the user selects make file option... (2 Replies)
Discussion started by: muraliinfy04
2 Replies

9. Shell Programming and Scripting

Script to change date/time

Hi everybody! I need to perform a task with a script but I have no idea how to do it, I hope someone could help me: - on my linux pc I have many folders with movies, tv shows, toons, ecc. They are shared by a dlna server to my panasonic tv where I can browse and see them. The problem is that... (6 Replies)
Discussion started by: Torquemada
6 Replies

10. Shell Programming and Scripting

Optimizing script to reduce execution time

AFILENAME=glow.sh FILENAME="/${AFILENAME}" WIDTHA=$(echo ${FILENAME} | wc -c) NTIME=0 RESULTS=$(for eachletter in $(echo ${FILENAME} | fold -w 1) do WIDTHTIMES=$(awk "BEGIN{printf... (5 Replies)
Discussion started by: SkySmart
5 Replies
libtar_list_new(3)						  C Library Calls						libtar_list_new(3)

NAME
libtar_list_new, libtar_list_free, libtar_list_next, libtar_list_prev, libtar_list_add, libtar_list_del, libtar_list_search, lib- tar_list_dup, libtar_list_merge, libtar_list_add_str - linked list routines SYNOPSIS
#include <libtar.h> libtar_list_t *libtar_list_new(int flags, int (*cmpfunc)()); void libtar_list_free(libtar_list_t *l, void (*freefunc)()); int libtar_list_add_str(libtar_list_t *l, char *str, char *delim); int libtar_list_add(libtar_list_t *l, void *data); void libtar_list_del(libtar_list_t *l, libtar_node_t **n); int libtar_list_search(libtar_list_t *l, libtar_node_t **n, void *data, int (*matchfunc)()); int libtar_list_next(libtar_list_t *l, libtar_node_t **n); int libtar_list_prev(libtar_list_t *l, libtar_node_t **n); libtar_list_t *libtar_list_dup(libtar_list_t *l); libtar_list_t *libtar_list_merge(int (*cmpfunc)(), int flags, libtar_list_t *list1, libtar_list_t *list2); DESCRIPTION
The libtar_list_new() function creates a new list. The flags argument must be one of the following values: LIST_USERFUNC The cmpfunc argument points to a user-supplied function which determines the ordering of the list. LIST_STACK Use the list as a stack. New elements are added to the front of the list. LIST_QUEUE Use the list as a queue. New elements are added to the end of the list. The libtar_list_free() function deallocates all memory associated with the list l. If freefunc is not NULL, it is called to free memory associated with each node in the list. The libtar_list_add() function adds the element pointed to by data to the list l. The position of the new element will be determined by the flags passed to libtar_list_new() when the list was created. The libtar_list_add_str() function tokenizes the string str using the delimiter characters in the string delim. The resulting tokens are added to list l using libtar_list_add(). The libtar_list_search() function searches for an element which matches data using the matching function matchfunc. If matchfunc is NULL, a default matching function designed for ASCII strings is used. Searching begins from the node pointed to by n. The libtar_list_del() function removes the entry pointed to by n from the list pointed to by l. The libtar_list_dup() function creates a copy of the list l using dynamically allocated memory. The libtar_list_merge() function creates a new list with flags and cmpfunc, in the same way as libtar_list_new(). It then adds all ele- ments from list1 and list2 using libtar_list_add(). RETURN VALUE
The libtar_list_new(), libtar_list_dup(), and libtar_list_merge() functions return a pointer to the new list structure, or NULL on error. The libtar_list_next(), libtar_list_prev(), and libtar_list_search() functions return 1 when valid data is returned, or 0 otherwise. The libtar_list_add() and libtar_list_add_str() functions return 0 on success, or -1 on error. SEE ALSO
libtar_hash_new(3) University of Illinois Jan 2000 libtar_list_new(3)
All times are GMT -4. The time now is 02:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy