Sponsored Content
Full Discussion: Performing lookup quickly
Top Forums Shell Programming and Scripting Performing lookup quickly Post 302590410 by dendright on Monday 16th of January 2012 05:36:57 AM
Old 01-16-2012
Performing lookup quickly

Hello,

Have been trying to develop a script that reads a string from an input file then looks up that string in a reference file to get a number, then inset that number back into the original file at a certain point (_____):
Code:
Input File:
HARRY   JON     _____     AA  M N
PETER   PIE     _____     BB  M Y
SARAHAASJOHNASAS_____     CC  F Y
 
Lookup File:
AA 95321
BB 75330
CC 91211

Becomes:
HARRY   JON     95321     AA  M N
PETER   PIE     75330     BB  M Y
SARAHAASJOHNASAS91211     CC  F Y

I tried rexx first but it was painfully slow probably because the lookup file is 167K lines long!

What is the fastest way to perform this kind of search in unix and can anyone give an example!

Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

please help quickly..

I want to pass arguments to a sh program and I want to use these arguments in the program as variables? Will I use argc and argv in a main function can anyone around me write the full code please for example when I write in th command sh myprogram.sh argument1 argument2 I want to use... (1 Reply)
Discussion started by: walnut
1 Replies

2. UNIX for Dummies Questions & Answers

need solution for this quickly. please quickly.

Write a nawk script that will produce the following report: ***FIRST QUARTERLY REPORT*** ***CAMPAIGN 2004 CONTRIBUTIONS*** ------------------------------------------------------------------------- NAME PHONE Jan | ... (5 Replies)
Discussion started by: p.palakj.shah
5 Replies

3. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies

4. UNIX for Dummies Questions & Answers

changing directory quickly without cd ..

Hi, I am in /home/development/project/abc directory. Now I want to remove one file which is kept in /trial/dev/<file> directory. I would like to do it in one command. I tried changing directory in one command like: pwd /home/development/project/abc cd ~/trial/dev/ bash: no command... (2 Replies)
Discussion started by: palak08
2 Replies

5. UNIX for Advanced & Expert Users

slow performing system

Friends Greetings. I have a RedHat 5.7 64bit virtual server on VMware ESXi 4.1. This server and other Redhat Servers are running very slow. I did some stats collection on ESXi and looks like Linux is holding the disk IO. I am not sure what is causing this behavior. On Linux I checked the CPU... (4 Replies)
Discussion started by: sdewal
4 Replies

6. Shell Programming and Scripting

Please Help quickly

Hello everyone! I am new here and by new i don't mean only in this place, but in this shell scripting area. I started learning about Operation Systems only 2 months ago. I want to learn more but i found a problem which I don't really know how to solve. :confused: I have a directory with 4... (2 Replies)
Discussion started by: Stripes07
2 Replies

7. Solaris

Service is restarting too quickly

Hi guys, one of my services in solaris 10 is in maintenance mode. When I checked why, the reason is that the service is "restarting too quickly." # svcs -x svc:/application/management/snmpdx:default svc:/application/management/snmpdx:default (Sun Solstice Enterprise Master Agent) State:... (2 Replies)
Discussion started by: cjashu
2 Replies

8. Programming

Performing a while for two files

Hi, This is for Perl. I have a while loop, and would like to process two files, the formats are given below : access access.<previousday>-* How can perform a while loop on both logs, while creating the logic for access.<previousday>-* to get format like "access.20130615-124139" when... (11 Replies)
Discussion started by: susankoperna1
11 Replies

9. Shell Programming and Scripting

Performing aggregation in File

Hi, I need help in UNIX shell script to handle the following: I have file called File1.txt which contains data something like below: LibraryName|BookName|Flag-Indicator|COUNT LIB1|BOOK1|A|12 LIB1|BOOK1|A|2 LIB2|BOOK2|I|1 LIB2|BOOK1|I|4 LIB1|BOOK2|A|12 LIB1|BOOK1|I|22... (3 Replies)
Discussion started by: vfrg
3 Replies
App::Asciio(3pm)					User Contributed Perl Documentation					  App::Asciio(3pm)

NAME
App::Asciio - Plain ASCII diagram | | | | | | | | | | | | | | | | v | v | v | v v v _____ _____ / _ / __ \_ ___ ___ _ _ -----> __ / __ / ___/ / -----> /\__, / \___' \_ \_ \_/\____/ \____/ \_ \_ \_____ /_//_//___/ /___/ /_//_//_____/ | | | | | | | | | | | v | | | v | | | v | | | v | | v v v (\_/) (O.o) ASCII world domination is near! (> <) SYNOPSIS
$> perl asciio.pl DESCRIPTION
This gtk2-perl application allows you to draw ASCII diagrams in a modern (but simple) graphical application. The ASCII graphs can be saved as ASCII or in a format that allows you to modify them later. Thanks to all the Perl-QA hackathon 2008 in Oslo for pushing me to do an early release. Special thanks go to the Muppet and the gtk-perl group, Gabor Szabo for his help and advices. Adam Kennedy coined the cool name. Sometimes a diagram is worth a lot of text in a source code file. It has always been painfull to do ASCII diagrams by hand. DOCUMENTATION
Asciio user interface .-----------------------------------------------------------------. | Asciio | |-----------------------------------------------------------------| | ............................................................... | | ..............-------------..------------..--------------...... | | .............| stencils > || asciio > || box |..... | | .............| Rulers > || computer > || text |..... | | .............| File > || people > || wirl_arrow |..... | grid---------->.......'-------------'| divers > || axis |..... | | ............................'------------'| boxes > |..... | | ......................^...................| rulers > |..... | | ......................|...................'--------------'..... | | ......................|........................................ | | ......................|........................................ | | ......................|........................................ | | ......................|........................................ | '-----------------------|-----------------------------------------' | | context menu context menu The context menu allows to access to asciio commands. ASCII is used to insert ASCII elements. keyboard shortcuts All the keyboad commands definitions can be found under asciio/setup/actions/. Among the commands implemented are: o select all o delete o undo o group/ungroup o open / save o local clipboard operations A window displaying the currently available commands is displayed if you press K. elements There but a few elements implemented at the moment. wirl arrow An arrow that tries to do what you want. Try rotating the end clockwise then counter clockwise to see how it acts ^ | | --------. | | '------- | | O-------------X / | / | / | / v / / v box and text Both are implemented within the same code. Try double clicking on a box to see what you can do with it. .----------. | title | .----------. |----------| ************ | | | body 1 | * * '----------' | body 2 | ************ '----------' anything in a box (\_/) | edit_me (O.o) <------------' (> <) your own stencils Take a look at setup/stencils/computer for a stencil example. Stencils lites in setup/setup.ini will be loaded when Asciio starts. your own element type For simple elemnts, put your design in a box. that should cover 90% of anyone's needs. You can look in lib/stripes for element implementation examples. exporting to ASCII You can export to a file in ASCII format but using the .txt extension. Exporting to the clipboard is done with ctl + e. EXAMPLES
User code ^ ^ OS code / / / User code <----Mode----->OS code / / / User code v v OS code .---. .---. .---. .---. .---. .---. OS API '---' '---' '---' '---' '---' '---' | | | | | | v v | v | v .------------. | .-----------. | .-----. | Filesystem | | | Scheduler | | | MMU | '------------' | '-----------' | '-----' | | | | v | | v .----. | | .---------. | IO |<----' | | Network | '----' | '---------' | | | v v v .---------------------------------------. | HAL | '---------------------------------------' .---------. .---------. | State 1 | | State 2 | '---------' '---------' ^ ^ / / / / / / / / / v v ****** ****** ****** * T1 * * T2 * * T3 * ****** ****** ****** ^ ^ / / / / stimuli / v .---------. '--------| State 3 | '---------' DEPENDENCIES
gnome libraries, gtk, gtk-perl, perl BUGS AND LIMITATIONS
Undoubtedly many as I wrote this as a fun little project where I used no design nor 'methodic' whatsoever. AUTHOR
Khemir Nadim ibn Hamouda CPAN ID: NKH mailto:nadim@khemir.net LICENSE AND COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SUPPORTED OSes Gentoo I run gentoo, packages to install gtk-perl exist. Install Ascii with cpan. FreeBSD FreeBSD users can now install asciio either by package: $ pkg_add -r asciio or from source (out of the ports system) by: $ cd /usr/ports/graphics/asciio $ make install clean Thanks to Emanuel Haupt. Ubuntu and Debian Ports are on the way. Windows AsciiO is part of camelbox and can be found here: <http://code.google.com/p/camelbox/>. Install, run AsciiO from the 'bin' directory. .-------------------------------. / /| / camelbox for win32 / | / / | / / | .-------------------------------. | | ______\_, | | | (_. _ o_ _/ | | | '-' \_. / | | | / / | | | / / .--. .--. | | | ( ( / '' / '' " | | | \_.' ) | | | || _ './ | | | | ___.' / | | | '-./ .' |/ | | | | / )| | | | |/ // \ | . | | __// \__ | / | //\ /__/ mrf\__| | / | .--_/ \_--. | / | /__/ \__ |/ '-------------------------------' camelbox is a great distribution for windows. I hope it will merge with X-berry series of Perl distributions. Mac OsX This works too (and I have screenshots to prove it :). I don't own a mac and the mac user hasn't send me how to do it yet. other unices YMMV, install gtk-perl and AsciiO from cpan. SEE ALSO
http://www.jave.de http://search.cpan.org/~osfameron/Text-JavE-0.0.2/JavE.pm http://ditaa.sourceforge.net/ http://www.codeproject.com/KB/macros/codeplotter.aspx http://search.cpan.org/~jpierce/Text-FIGlet-1.06/FIGlet.pm http://www.fossildraw.com/?gclid=CLanxZXxoJECFRYYEAodnBS8Dg (doesn't always respond) http://www.ascii-art.de (used some entries as base for the network stencil) http://c2.com/cgi/wiki?UmlAsciiArt http://www.textfiles.com/art/ http://www2.b3ta.com/_bunny/texbunny.gif *o_ _o/* / * * < *o/* /> ) o/* / > *o < /> __o */ /* o__ * /> < * /* __o_ _o__ */ * / * * * < /> *o/* ejm97 __)__ perl v5.10.1 2010-04-25 App::Asciio(3pm)
All times are GMT -4. The time now is 03:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy