Sponsored Content
Top Forums Shell Programming and Scripting Script to loop line in a file and add info or do echo Post 302634643 by neutronscott on Thursday 3rd of May 2012 03:47:57 PM
Old 05-03-2012
Code:
printf '  p.add("%s",%.0f)\n' "$key" "${val%?}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to echo the file contents LINE BY LINE

hello, i have a listing (let say ABC) consists of the below: : public database link public synonym role rollback segment : when i run the below for loop, for i in `more ABC` do echo "$i" done it gives me, : public database (4 Replies)
Discussion started by: newbie168
4 Replies

2. Shell Programming and Scripting

trying to write a script to loop through a port info file

Below is part of a script i have written to loop through part of a port info file. How do i continue the script to get info for OS Device Name, manufacturer and then put information into an array? HBA Port WWN: 10000000c9420b4b OS Device Name: /dev/cfg/c10 Manufacturer: Emulex... (5 Replies)
Discussion started by: rcon1
5 Replies

3. UNIX for Dummies Questions & Answers

echo a line number when script is executing

BTW, this is my first post and I'm fairly new to Unix. :D I'm having issues with a korn shell script running abnormally long. What we would like to do is echo the line number the job is executing at the time. Is there any sort of function or environment variable that allows such a thing? ... (1 Reply)
Discussion started by: gavineq
1 Replies

4. Shell Programming and Scripting

How to pull info under headers in file(awk,grep,while loop)

below is an extract from my file and I am trying to use Awk and grep and a while loop to pull infomation from under neath "HBA WWN=".HBA WWN=" reoccurs all over the file but the 100000c.....number are unique and I want to be able to pull and reference specifi information under this header ever time... (2 Replies)
Discussion started by: kieranfoley
2 Replies

5. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

6. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

7. Shell Programming and Scripting

Adding line in a file using info from previous line

I have a shell script that looks something like the following: mysql -uroot db1 < db1.sql mysql -uroot db2 < db2.sql mysql -uroot db3 < db3.sql mysql -uroot db4 < db4.sql .... different db names in more than 160 lines. I want to run this script with nohup and have a status later. So,... (6 Replies)
Discussion started by: MKH
6 Replies

8. Shell Programming and Scripting

BASH - Need to echo for loop output to one line

I'm trying to echo the release version of some of our Linux servers. Typically I do these types of things by "catting" a text file with the host names, "ssh-ing" to the host and running my string. This is what I've written for i in `cat versions.txt` ; do echo $i ; ssh $i cat /etc/issue |... (5 Replies)
Discussion started by: lombardi4851
5 Replies

9. Shell Programming and Scripting

Echo print on same line while loop using variable

Currently using below script but echo it print the output in two line. Input file all-vm-final-2.txt CEALA08893 SDDC_SCUN DS_SIO_Workload_SAPUI_UAT_01 4 CEALA09546 SDDC_SCUN DS-SIO-PD5_Workload_UAT_SP1_Flash_07 4 CEALA09702 SDDC_SCUN DS-VSAN-RMP-WORKLOAD01 4 DEALA08762 SDDC_LDC... (3 Replies)
Discussion started by: ranjancom2000
3 Replies

10. UNIX for Beginners Questions & Answers

Echo For ... Loop output into a file

Hi, All: I have one for ... loop code to generate a list of rename statement. However, echo the loop output on screen is OK. But store the echo output into a file is not working. So come here to seek help. My basic code is: ! /bin/ksh echo > DAS_VetFed.txt dir=/mydirectory cd $dir files=`ls... (6 Replies)
Discussion started by: duke0001
6 Replies
Cache::File::Heap(3pm)					User Contributed Perl Documentation				    Cache::File::Heap(3pm)

NAME
Cache::File::Heap - A file based heap for use by Cache::File SYNOPSIS
use Cache::File::Heap; $heap = Cache::File::Heap->new('/path/to/some/heap/file'); $heap->add($key, $val); ($key, $val) = $heap->minimum; ($key, $val) = $heap->extract_minimum; $heap->delete($key, $val); DESCRIPTION
This module is a wrapper around a Berkeley DB using a btree structure to implement a heap. It is specifically for use by Cache::File for storing expiry times (although with a bit of work it could be made more general). See LIMITATIONS below. CONSTRUCTOR
my $heap = Cache::File::Heap->new( [$dbfile] ); The heap constructor takes an optional argument which is the name of the database file to open. If specified, it will attempt to open the database during construction. A new Cache::File::Heap blessed reference will be returned, or undef if the open failed. METHODS
$h->open($dbfile) Opens the specified database file. $h->close() Closes a previously opened heap database. Note that the database will be automatically closed when the heap reference is destroyed. $h->add($key, $val) Adds a key and value pair to the heap. Currently the key should be a number, whilst the value may be any scalar. Invokes 'die' on failure (use eval to catch it). $h->delete($key, $val) Removes a key and value pair from the heap. Returns 1 if the pair was found and removed, or 0 otherwise. ($key, $val) = $h->minimum() In list context, returns the smallest key and value pair from the heap. In scalar context only the key is returned. Note smallest is defined via a numerical comparison (hence keys should always be numbers). ($key, $vals) = $h->minimum_dup() In list context, returns the smallest key and an array reference containing all the values for that key from the heap. In scalar context only the key is returned. ($key, $val) = $h->extract_minimum() As for $h->minimum(), but the key and value pair is removed from the heap. ($key, $vals) = $h->extract_minimum_dup() As for $h->minimum_dup(), but all the values are removed from the heap. SEE ALSO
Cache::File AUTHOR
Chris Leishman <chris@leishman.org> Based on work by DeWitt Clinton <dewitt@unto.net> COPYRIGHT
Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved. This module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. This program is free software; you can redistribute or modify it under the same terms as Perl itself. $Id: Heap.pm,v 1.6 2006/01/31 15:23:58 caleishm Exp $ perl v5.12.4 2011-08-05 Cache::File::Heap(3pm)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy