Sponsored Content
Top Forums Programming Adding information to c file using perl Post 302562275 by veerubiji on Thursday 6th of October 2011 11:41:07 AM
Old 10-06-2011
Hi,
Actuvally i am trying like this, I have two hash tables.

Hash table1 contains strings and their numbers like as shown below
(value) (key)
pressure 2034
temperature 2035
humidity 2036 like that i have 100 stings and and numbers.

second hash table contains numbers and information like as shown below
(key) (value)
2034 information
2035 information
2036 information
.......................... like this, i have 100 strings and 100 unique numbers to the strings.

In my c file i have the strings names what i have in hash table1 like pressure, temperature, humidity ........

now i have to test if string matches in the c file then add according number and information before the string. this is my hole problem, i have to implement perl script for this task.

I am very beginner to perl, i am trying like this.
thanks in advance.

regards,
veerubiji.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: adding columns in CSV file with information in each

Hi Wise UNIX Crew, I want to add 3 different columns to the file in which: 1. The first new column pulls in today's date and time 2. Second column one has a '0' 3. Third column has the word 'ANY' going down the column If my file content is as follows: "7","a","abc",123"... (1 Reply)
Discussion started by: dolo21taf
1 Replies

2. Shell Programming and Scripting

cant get perl to pull information right

Hello, I cant get the perl script to pull the information from Sark DNS 4.X Options ACL Templates= and other= Can someone look at the script to see why and fix it please. FYI..Under Sark DNS 4.x ACL Templates= and other= has an indent/tab, not sure if thats the reason my the script... (24 Replies)
Discussion started by: richsark
24 Replies

3. Shell Programming and Scripting

Adding new lines to a file + adding suffix to a pattern

I need some help with adding lines to file and substitute a pattern. Ok I have a file: #cat names.txt name: John Doe stationed: 1 name: Michael Sweets stationed: 41 . . . And would like to change it to: name: John Doe employed permanently stationed: 1-office (7 Replies)
Discussion started by: hemo21
7 Replies

4. Shell Programming and Scripting

Print file information using ffmpeg in perl

I am trying to print file information using ffmpeg tool in perl Here is my code use strict; use warnings; use IPC::Open3; # example my $filename = $ARGV; my %videoInfo = videoInfo($filename); print "duration: " . $videoInfo{'duration'} . "\n"; print "durationsecs: " .... (0 Replies)
Discussion started by: srijith
0 Replies

5. Shell Programming and Scripting

perl script to print file information - newbie

Hi I have a perl script that prints all the video and audio file information(playing duration). It works fine in one of my friends linux laptop. But it doesn't work in my both windows and linux. My friend told me I have to do install some module ( ppm instal ...... ) but I have no... (1 Reply)
Discussion started by: srijith
1 Replies

6. Shell Programming and Scripting

Parsing information in perl

So i'm trying to write a perl script that logins into a network switch via ssh: #sh ip traffic IP statistics: Rcvd: 1460119147 total, 563943377 local destination 0 format errors, 0 checksum errors, 48401998 bad hop count 0 unknown protocol, 8379279 not a gateway ... (2 Replies)
Discussion started by: streetfighter2
2 Replies

7. UNIX for Dummies Questions & Answers

Perl - adding columns to file

I have a file in which I need to add more columns to based on a key in the first file: File1 key1,abc,123, key2,def,456, key3,ghi,789, File2 key2,zyx,111,qqq, key3,yuu,222,www, key1,pui,333,eee, key4,xxx,999,rrr, I would like to create the following output: Output (1 Reply)
Discussion started by: WongSifu
1 Replies

8. Web Development

Tapatalk Modification for vB3 - Adding User for System Information

Referring back to this thread: Tapatalk Modification for vB3 - Issue with Avatar Icons I mentioned that we had some "system bot" code: In this post, I describe that code and how easy it is to create a "system bot" user for Tapatalk (TT): Basically, its quite easy. We add a hook to... (0 Replies)
Discussion started by: Neo
0 Replies

9. Shell Programming and Scripting

Perl to extract information from a file line by line

In the below perl code I am using tags within each line to extract certain information. The tags that are used are: STB >0.8 is STRAND BIAS otherwise GOOD FDP is the second number GO towards the end of the line is read into an array and the value returned is outputed, in the first line that... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. UNIX for Beginners Questions & Answers

Adding to an array in an external file, and adding elements to it.

I have an array in an external file, "array.txt", which contains: char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Discussion started by: ignatius
29 Replies
DIGITEMP(1)						      General Commands Manual						       DIGITEMP(1)

NAME
digitemp - program to read from temperature sensors. SYNOPSIS
digitemp [options] DESCRIPTION
DigiTemp uses the Dallas 1-wire bus to read temperatures from digital sensors attached to a serial port adapter. It handles initializing the bus, searching for attached devices, reading devices and custom log strings. It suports the following temperature devices: DS1820, DS18S20, DS18B20, DS1822 It also handles the DS2406 1-wire hub switches, and DS2422 and DS2423 counters. DigiTemp uses either the DS9097 passive serial port adapter, or the DS2480B based DS9097U adapter (recommended). OPTIONS
At least 1 action must be given, along with some optional arguments. Actions are one (and only on) of the -w -t -a -w options -h, -? Show summary of options. -v Show verbose output. -i Initialize .digitemprc file, search the bus for all supported devices. -w Walk the full device tree and display the serial number and type of all devices detected on the bus. -s /dev/ttyS0 Set serial port to use. Make sure you have permission to access this port. -l /var/log/temperature Send output to logfile, the output format is defined by the .B -o command -c digitemp.conf Set digitemp configuration file. The default is .digitemprc in the current directory. -r 1000 Read delay in ms. This sets the amount of time to wait between sending the temperature conversion command and reading the result. The DS18S20 takes about 750mS to do the temperature conversion. Default is 1000mS (1 sec). -t # Read sensor number #, the # depends on the order of the sensors in the .digitemprc file. -q Quiet output, no copyright banner. -a Read all sensors. -A Treat DS2438 as A/D converter, output raw voltages -d 5 Delay between samples (in seconds). -n 50 Number of times to repeat the command. -O"counter format string" See Counter Format below. -o [1..3] ["output format string"] See Temperature Format below. -H"Humidity format string" See Humidity Format below. Temperature Format The temperature format can be either a numeric value, or a string. The numeric values select pre-configured output formats: 1 = One line per sensor, time, C, F (default) 2 = One line per sample, elapsed time, temperature in C 3 = Same as #2, except temperature is in F #2 and #3 have the data separated by tabs, suitable for import into a spreadsheet or other graphing software. The format string uses strftime tokens plus 5 special ones for DigiTemp: %s for sensor # %C for centigrade %F for fahrenheit %R to output the hex serial number %N for seconds since Epoch. The case of the token is important! The default format string is: "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F" which gives you an output of: May 24 21:25:43 Sensor 0 C: 23.66 F: 74.59 The DS2438 sensor can be used for a variety of things. It includes a temperature sensor and A/D converter. DigiTemp defaults to using it as a humidity sensor. The raw voltages can be displayed by passing the -A argument When the -o2 or -o3 log options are used the attached DS2438's temperatures will be output without the humidity. Counter Format String The counter format string is similar, adding these tokens: %n is the counter #, which depends on its position in the .digitemprc file %C is the count in decimal. Humidity Format String The Humidity format string is the same as the temperature format string with the addition of this format specifier: %h is the humidity in 0-100% AUTHOR
This manual page was written by Jesus Roncero <jesus@roncero.org>, for the Debian project (but may be used by others). Modifications by Brian C. Lane <bcl@brianlane.com> UPDATES
DigiTemp updates can be found on the http://www.digitemp.com website. June 2005 DIGITEMP(1)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy