Sponsored Content
Top Forums Shell Programming and Scripting Finding difference in between two array's of strings Post 302878217 by neutronscott on Thursday 5th of December 2013 05:07:41 AM
Old 12-05-2013
Code:
mute@thedoctor:~$ ./script
declare -a new='([0]="Purge Concurrent Request and/or Manager Data" [1]="Purge Signon Audit data" [2]="Never see me")'
mute@thedoctor:~$ cat script
#!/bin/bash

inarray() {
        local n=$1 h

        shift
        for h; do
                [[ $n = "$h" ]] && return
        done
        return 1
}

purge=("Purge Concurrent Request and/or Manager Data" "Purge Signon Audit data" "Purge Obsolete Workflow Runtime Data" "Purge Logs and Closed System Alerts")
purge_1=("Purge Obsolete Workflow Runtime Data" "Purge Logs and Closed System Alerts" "Never see me")

for e in "${purge[@]}"; do
        inarray "$e" "${purge_1[@]}" || new=("${new[@]}" "$e")
done
for e in "${purge_1[@]}"; do
        inarray "$e" "${purge[@]}" || new=("${new[@]}" "$e")
done

declare -p new

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding the time difference

Hi, I have two files A.txt and B.txt. And i have the following attributes in both the files. <date and time> <a unique id> For eg: <2007 May 30 20:29:36:034 GMT> <ID1> in A.txt <2007 May 30 20:42:36:038 GMT> <ID1> in B.txt Now, i need to find the time difference... (0 Replies)
Discussion started by: padma.raajesh
0 Replies

2. Shell Programming and Scripting

finding difference between 2 directory recursively

Hi, i'm trying to compare two directories in Unix. I need a recursive search ie my shell script should also compare common files in those two directory and so on... any clues.. ?? (2 Replies)
Discussion started by: yayati
2 Replies

3. Shell Programming and Scripting

Finding strings

Hi I made a post earlier but now my problem has become a lot more complicated. So I have a file that looks like this: Name 1 13 94 1 AGGTT Name 1 31 44 1 TTCCG Name 1 13 94 2 AAAAATTTT Name 1 41 47 2 GGGGGGGGGGG So the file is tab delimited and what I want to do is find... (8 Replies)
Discussion started by: kylle345
8 Replies

4. Shell Programming and Scripting

Finding number of strings in List

I have a list of strings stored in $Lst Example set Lst = "John Fred Kate Paul" I want to return 4 in this case. (1 Reply)
Discussion started by: kristinu
1 Replies

5. Shell Programming and Scripting

Finding strings through multiple lines

Hi, I need to search for a multiple line pattern and remove it the pattern is search for (ln number) <TABLE name=*> and if 3 lines below that the line is (ln number) </TABLE> Then remove those 4 lines. Thank you (14 Replies)
Discussion started by: legolad
14 Replies

6. Shell Programming and Scripting

finding difference between two files

Hi, I have two files one with 12486 lines second one with 13116 As per the comparsion between two files the count have 630 difference I used diff command to find the difference between two files but it's not understandable could any one suggest any command to get 630 records in a new... (4 Replies)
Discussion started by: thelakbe
4 Replies

7. Shell Programming and Scripting

Need help in finding in date difference

Hi, My date is coming as STARTDATE=Sun Jul 15 00:34:23 2012 ENDDATE=Sun Jul 15 00:50:04 2012I want difference between these two dates,anyone's helps will be appriciated. Thanks Prasoon (3 Replies)
Discussion started by: prasson_ibm
3 Replies

8. Shell Programming and Scripting

Finding first difference between two files

Hi! I'd like to know if it is possible for a command to find the first difference between two large files, output that line from both file and stop, so no need to continue after that to save some computation time. I don't think looping through it will be efficient enough but that's the only... (6 Replies)
Discussion started by: Mojing
6 Replies

9. UNIX for Dummies Questions & Answers

Finding similar strings between two files

Hi, I have a file1 like this: ABAT ABCA1 ABCC1 ABCC5 ABCC8 ABCE1 ABHD2 ABL1 CAMTA1 ACBD3 ACCN1 And I have a second file like this: chr19 46118590 46119564 MACS_peak_1499 3100.00 chr19 46122009 46148405 CYP2B7P1 -2445 chr1 7430312 7430990... (7 Replies)
Discussion started by: a_bahreini
7 Replies

10. Shell Programming and Scripting

Finding difference in 2 different timestamps

Legends, I have a requirement to run the script exactly after one hour of completion of dependent script. Eg: Script B should run after one hour on the completion of Script A. I got the time stamps using following variables. these scripts runs in autosys > DATE=`date +%H:%M` >... (4 Replies)
Discussion started by: sdosanjh
4 Replies
dzhandle(1)						      General Commands Manual						       dzhandle(1)

NAME
dzhandle -- Debian/Ubuntu Zope packages handling command line utility SYNOPSIS
dzhandle [options] action [action options] DESCRIPTION
dzhandle is the command-line utility for handling Zope servers, instances and products. It is a system administration tool and a Debian/Ubuntu maintainer's helper script at the same time: using dzhandle you can manage your Zope installations, create instances, add Zope products to them, start and stop them, but it is also used by the Debian/Ubuntu Zope packages for their installation and removal. OPTIONS
-h, --help Print usage information and exit -f, --force Force things, for example file overwriting or removing -z, --zope-version=ZVERSIONS limit actions to a comma separated list of zope versions; default behaviour is to act on all zope versions available -u, --user=USER[:GROUP] User/Group ownership for new and copied files -c, --config-file=FILE Configuration file; default is /etc/dzhandle.conf -v, --verbose Enable verbose mode (not yet implemented) -n, --dry-run Do not execute commands, print only them (not yet implemented) ACTIONS (instances handling) make-instance <instance> -m AMODE [<options>] Create a new instance running Zope version specific mkzopeinstance. -m AMODE, --addon-mode=AMODE Which products and extensions will be installed: `all' means every product or extension available will be automatically installed, `manual' means that the products or extensions will be installed manually through dzhandle. This option is mandatory. -t ATECHNIQUE, --addon-install-technique=ATECHNIQUE How to install addons: `linked' means the product or extension directory will be symlinked into the instance home, `tree-linked' means the directory structure will be re-created and then files symlinked, `copied' means the file will be copied into the instance home. Default: tree-linked. -r RESTART, --restart=RESTART when to restart on configuration of new products or extensions: `configuring' means after every product or extension configuration, `end' means at the end of the installation of all packages, `manually' means no automatic restart will happen. Default: end -u USER, --user=USER user and password for the initial user (in the form `user:password'); these settigs can be modified later using zpasswd.py utility from Zope. You'll be prompted for an username and password if the options is omitted. --service-user=SRVUSER system user used to run this instance (in the form `user:groupdefault'); this setting can be modified later editing the zope.conf file of the instance. Default: zope:zope --service-port=SRVPORT HTTP port used to run this instance; this setting can be modified later editing the zope.conf file of the instance. Default: 9673 --skelsrc=SKEL the directory from which skeleton files should be copied; must at least contain the following directories: `bin', `etc', `Extensions', `import', `lib', `log', `Products', `var' and files: `bin/zopeservice.py.in', `bin/run- zope.bat.in', `bin/runzope.in', `bin/runzope.in', `bin/zopectl.in', `etc/zope.conf.in'. Default: /usr/lib/zopeVER/skel remove-instance <instance> Remove an instance (except data files) and mark it as removed. purge-instance <instance> Purge files for an instance (including data files). show-instance <instance> Print a short summary about an instance. list-instances Print the list of available instances. instance-addon-mode <instance> [<mode>] Get or set an addon-mode for an instance. instance-addon-technique <instance> [<technique>] Get or set an addon-install-technique for an instance. instance-restart-policy <instance> [<restart-policy>] Get or set a policy on addon-installation for an instance. zopectl <instance> <zdctl-action> [<zdctl options>] Call a zopectl action (e.g. `start', `stop' or `restart') for a given instance. restart-pending-instances Restart instances with `restart-pending' markers. ACTIONS (ZEO instances handling) make-zeoinstance <instance> Create a new instance running Zope version specific mkzeoinstance. purge-zeoinstance <instance> Purge files for a ZEO instance (including data files). list-zeoinstances Print the list of available ZEO instances. zeoctl <instance> <zeotl-action> [<zeotl options>] Call a zeoctl action (e.g. `start', `stop' or `restart') for a given ZEO instance. ACTIONS (products and extensions handling) list-products, list-extensions show all products or extensions managed by dzhandle add-product, add-extension add a product or extension to an instance -l, --lazy Add missing addons only (error on manually installed addons). -t ATECHNIQUE, --addon-install-technique=ATECHNIQUE How to install the specified addons. remove-product, remove-extension remove a product or extension from an instance -l, --lazy Do not complain about already removed addons. -f, --force Force removal of the addons. ACTIONS (for Zope products maintainers) The following actions should be used inside the maintainer scripts of Debian/Ubuntu packages of Zope products and extensions. If the pack- age uses zope-debhelper's dh_installzope, these actions will be automatically included. dinstall-extension, dinstall-product install a packaged extension/product dremove-extension, dremove-product remove a packaged extension/product postinst-extension, postinst-product handle postinst of a packaged extension/product postrm-extension, postrm-product handle postrm of a packaged extension/product preinst-extension, preinst-product handle preinst of a packaged extension/product prerm-extension, prerm-product handle prerm of a packaged extension/product show-package-info show various information about zope packages SEE ALSO
dh_installzope(1), dh_installzopeinstance(1) AUTHOR
This manual page was written by Fabio Tranchitella <kobold@debian.org> for the Debian GNU/Linux and Ubuntu Linux systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license can be found under /usr/share/common-licenses/FDL. dzhandle(1)
All times are GMT -4. The time now is 09:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy