Sponsored Content
Full Discussion: BASH, HASH and AWK
Top Forums UNIX for Dummies Questions & Answers BASH, HASH and AWK Post 302266550 by Corpsehy on Wednesday 10th of December 2008 01:39:49 PM
Old 12-10-2008
What I really need help with, is a script that searches for a changable string, if it finds it, we replace the output with the corresponding value/string.

say if I have a datafile with this info(string to search for separated by a , with the output after it):

Code:
data searchable string, this is for the output to be posted
another searchable string, this is yet again for the output to be posted.
third wonder searchable, this is another output string

It would without a hitch with either ; or = or any other sign to separate the two, just so if the first is found, the second is posted.

Any ideas? :-)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Hash Function.

I have a file with a format of A,2 B,2 G,3 A,2 A,3 A,2 D,7 A,2 E,2 A,2 I need to create a sum of each alphabet with the numbers assigned to it using awk. (2 Replies)
Discussion started by: dinjo_jo
2 Replies

2. Shell Programming and Scripting

Print Entire hash list (hash of hashes)

I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes). Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash. Most of the printing seems to be OK but in... (1 Reply)
Discussion started by: Alalush
1 Replies

3. Shell Programming and Scripting

Assigning a hash to another hash key

Hello, I have a hash in hsh. I need to assign it to another hash globalHsh. I think the below statement does not work $globalHsh{$id} = %hsh; What is the right way to assign it? Thanks (3 Replies)
Discussion started by: rsanjay
3 Replies

4. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

5. Shell Programming and Scripting

perl hash - using a range as a hash key.

Hi, In Perl, is it possible to use a range of numbers with '..' as a key in a hash? Something in like: %hash = ( '768..1536' => '1G', '1537..2560' => '2G' ); That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Discussion started by: dsw
3 Replies

6. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

7. Shell Programming and Scripting

Dynamically parse BibTeX and create hash of hash

Hello gurus, Iam trying to parse following BibTex file (bibliography.bib): @book{Lee2000a, abstract = {Abstract goes here}, author = {Lee, Wenke and Stolfo, Salvatore J}, title = {{Data mining approaches for intrusion detection}}, year = {2000} } @article{Forrest1996, abstract =... (0 Replies)
Discussion started by: wakatana
0 Replies

8. UNIX for Dummies Questions & Answers

Help in awk/bash

Hi, I am also a newbie in awk and trying to find solution of my problem. I have one reference file 1.txt with 2 columns and I want to search other 10 files (a.txt, b.txt......h.txt each with 5 columns) corresponding to the values of 2nd column from 1.txt. If the value from 2nd column from 1.txt... (0 Replies)
Discussion started by: bioinfo
0 Replies

9. Shell Programming and Scripting

awk command hash array not printing

I'm new to awk command. The HASH ARRAY is not printing. Merging 2 files togather. vault_input.txt 3P04_Dep_Inxml:2230 REM02_Dep_Inxml:2200 REM03_Dep_Inxml:2400 REM05:2200 REM06:2200 tst6.txt Nov:10:2115:3P04_Dep_Inxml Nov:10:2129:REM02_Dep_Inxml Nov:10:2235:REM03_Dep_Inxml... (5 Replies)
Discussion started by: Sanj123
5 Replies

10. Shell Programming and Scripting

Need to print hash of hash in table format

Hi, I have a hash of hash where it has name, activities and count i have data like this - $result->{$name}->{$activities} = $value; content of that are - name - robert tom cat peter activities - running, eating, sleeping , drinking, work i need to print output as below ... (3 Replies)
Discussion started by: asak
3 Replies
MEMUSAGESTAT(1) 					     Linux programmer's manual						   MEMUSAGESTAT(1)

NAME
memusagestat - generate graphic from memory profiling data SYNOPSIS
memusagestat [option]... datafile [outfile] DESCRIPTION
memusagestat creates a PNG file containing a graphical representation of the memory profiling data in the file datafile; that file is gen- erated via the -d (or --data) option of memusage(1). The red line in the graph shows the heap usage (allocated memory) and the green line shows the stack usage. The x-scale is either the num- ber of memory-handling function calls or (if the -t option is specified) time. OPTIONS
-o file, --output=file Name of the output file. -s string, --string=string Use string as the title inside the output graph. -t, --time Use time (rather than number of function calls) as the scale for the X axis. -T, --total Also draw a graph of total memory consumption. -x size, --x-size=size Make the output graph size pixels wide. -y size, --y-size=size Make the output graph size pixels high. -?, --help Print a help message and exit. --usage Print a short usage message and exit. -V, --version Print version information and exit. EXAMPLE
See memusage(1). BUGS
To report bugs, see <http://www.gnu.org/software/libc/bugs.html> SEE ALSO
memusage(1), mtrace(1) GNU
2014-09-06 MEMUSAGESTAT(1)
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy