Sponsored Content
Full Discussion: Help with code
Top Forums Shell Programming and Scripting Help with code Post 302753637 by Don Cragun on Wednesday 9th of January 2013 05:54:00 AM
Old 01-09-2013
Here are a couple of ways to do what you want:
Code:
#!/bin/ksh
echo simplififed translation from given code
while read i
do      grep $i /tmp/b | awk '{printf("echo mail -s \"%s is your new ID\" %s@companydomain.com", $2, $1)}' | ksh
done < /tmp/a

echo awk replacement
awk 'FNR == NR {
        newID[$1] = $2
        next
}
{       printf("echo mail -s \"%s is your new ID\" %s@companydomain.com\n",
                newID[$1], $1);
}' /tmp/b /tmp/a | ksh

I use ksh and I added echo commands in several places so it will show what it will do rather than actually invoke mail to send messages. You'll need to change /bin/ksh in the first line of the script to the absolute pathname of a shell on your system that processes traditional Bourne shell command syntax (e.g., bash, ksh, or sh) to run the script and then remove echo from the awk printf() command after you verify that the script does what you want.

Choose whichever code segment you prefer to use. They both should do what you want. The first segment is a simplified and corrected version of what it looked like you were trying to do. The second one produces the same results, but should be more efficient.
These 2 Users Gave Thanks to Don Cragun For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Return code from PL/SQL Code

Hi Guys, I was just wondering if anybody can help me with this problem. OK, how we can get a value back from PL/SQL Script (not stored procedure/function) See the below example: (for example aaa.sh) #!/bin/ksh VALUE=`sqlplus -s user/password@test_id <<EOF @xxx.sq EOF` echo $VALUE ... (7 Replies)
Discussion started by: Shaz
7 Replies

2. Programming

how i prepare a c++ code(c code) for implementing my own protocol format

helo my protocol format is given below { destno,mode,no.of packet,pktsize,,pktno,textsize,CRC} description:- { is starting flag destno - 4bytes mode - 1 byte no.of pkt - 4byes pktsize - 6 bytes ... (1 Reply)
Discussion started by: amitpansuria
1 Replies

3. Shell Programming and Scripting

translate ksh code to csh code

hi all, Can any 1 help me translate this korn shell code to C shell code : email=$(grep "^$1" $folder/config_2.txt | awk '{print $2'}) In config_2.txt the content is : which mean in korn shell , $1=groupname and $2=email address. Now i need to write in C shell script,when i set the... (2 Replies)
Discussion started by: proghack
2 Replies

4. UNIX for Dummies Questions & Answers

If ‘922’ Code does not exist on ‘03’ Record, ‘901’ Code will be there instead, move ‘03’ R

01,011600033,011600033,110516,0834,2,90,,2/ 02,011600033,011103093,1,110317,0834,,2/ 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+000000 00354,,/ 03,113806,,015,+00000559618,,,901,+00000000096,,,922,+000000 00621,,/ 88,902,+0000000025218,,/... (1 Reply)
Discussion started by: sgoud
1 Replies

5. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

6. Linux

Go to a line of code , skip few lines of code

Hi , I have a code where i am using a infinite while loop . some thing like below while do if then #go to line 20 fi command 1; command 2; #line 20: sleep 34; (5 Replies)
Discussion started by: Paarth
5 Replies
Bio::TreeIO::svggraph(3pm)				User Contributed Perl Documentation				Bio::TreeIO::svggraph(3pm)

NAME
Bio::TreeIO::svggraph - A simple output format that converts a Tree object to an SVG output SYNOPSIS
use Bio::TreeIO; my $in = Bio::TreeIO->new(-file => 'input', -format => 'newick'); my $out = Bio::TreeIO->new(-file => '>output', -format => 'svggraph'); while( my $tree = $in->next_tree ) { my $svg_xml = $out->write_tree($tree); } DESCRIPTION
This outputs a tree as an SVG graphic using the SVG::Graph API FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Brian OConnor Email brian.oconnor-at-excite.com CONTRIBUTORS
Allen Day Guillaume Rousse, Guillaume-dot-Rousse-at-inria-dot-fr APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::TreeIO::svggraph->new(); Function: Builds a new Bio::TreeIO::svggraph object Returns : Bio::TreeIO::svggraph Args :-width => image width (default 1600) -height => image height (default 1000) -margin => margin (default 30) -stroke => stroke color (default 'black') -stroke_width=> stroke width (default 2) -font_size=> font size (default '10px') -nomalize => undef or 'log' (default is undef) write_tree Title : write_tree Usage : $treeio->write_tree($tree); Function: Write a tree out to data stream in newick/phylip format Returns : none Args : Bio::Tree::TreeI object decorateRoot Title : _decorateRoot Usage : internal methods Function: Example : Returns : Args : next_tree Title : next_tree Usage : Function: Sorry not possible with this format Returns : none Args : none perl v5.14.2 2012-03-02 Bio::TreeIO::svggraph(3pm)
All times are GMT -4. The time now is 08:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy