03-11-2010
Is this another homework question?
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in
this forum under
special homework rules.
Please review the
rules, which you agreed to when you registered, if you have not already done so.
More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.
If you did post homework in the main forums, please review the
guidelines for posting homework and repost.
Thank You.
The UNIX and Linux Forums.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have to update last line of a text file with the number of lines in that file. This last line will have text such as 0.0000 and I should replace this with number lines. If lines are 20 then it should be replaced with 00020. Any sed or awk cmd help would be appreciated (3 Replies)
Discussion started by: bmkux
3 Replies
2. Shell Programming and Scripting
All,
I know this is a very naive question but I could not find a way to get this working!
I have a file with values like
input.file
Value1
Value2
server1/mylogin,mypasswd
Value3
Value4
And in my code, I am reading the file line by line and processing it.
#! /bin/ksh... (6 Replies)
Discussion started by: bharath.gct
6 Replies
3. UNIX for Dummies Questions & Answers
Hi. I have a basic script in python that outputs like this..
$ ./test.py
1%
2%
3%
4%
5%
6%
7%
8%
9%
10%
...
But how can I make it so the output stays in 1 line?
So it would look something like this..
$ ./test.py
10% (1 Reply)
Discussion started by: cbreiny
1 Replies
4. Shell Programming and Scripting
Hi everyone
i need one help don't know whether it is simple or difficult but not able to solve it.
here is the problem
suppose my code is
time_def=3
r=0
while ]
do
echo "time left is $time_def "
((time_def=time_def-1))
done
and the output is
time left is 3
time left... (6 Replies)
Discussion started by: aishsimplesweet
6 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I need to replace the record count which is in the last line of the text file to a new record count.
The file is a fixed length file, and whole file is list of numbers and the last line looks like this.
9#EOF# 00000000000000000016 ... (9 Replies)
Discussion started by: shinny
9 Replies
6. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
7. Shell Programming and Scripting
I have a text file like this:
subject1:LecturerA:10
subject2:LecturerA:40
if I was given string in column 1 and 2 (which are subject 1 and LecturerA) , i need to update 3rd field of that line containing that given string , which is, number 10 need to be updated to 100 ,for example.
The... (6 Replies)
Discussion started by: bmtoan
6 Replies
8. Shell Programming and Scripting
Hi all,
I have a file called "text.cpp" with the first line of "1"
afterwards I tried in Ubuntu to type the following
sed '12iasdasdasdasdsad' test.cpp > output.txt
however when I tried to see the result of output.txt
#cat output.txt
1
why is the line 12 is not updated to the... (6 Replies)
Discussion started by: peuceul
6 Replies
9. Shell Programming and Scripting
Hi,
I have a xml file that I need to modify 1 line to change some value from 2 to 10 (or any number).
Sample input:
<!-- some text here>
.
.
.
<message:test name="ryan">
<message:sample-channel charset="UTF-8" max-value="2" wait="20">
... (5 Replies)
Discussion started by: brichigo
5 Replies
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT DEBIAN
chi::driver::rawmemory
CHI::Driver::RawMemory(3pm) User Contributed Perl Documentation CHI::Driver::RawMemory(3pm)
NAME
CHI::Driver::RawMemory - In-process memory cache that stores direct references
VERSION
version 0.54
SYNOPSIS
use CHI;
my $hash = {};
my $cache = CHI->new( driver => 'RawMemory', datastore => $hash );
my $cache = CHI->new( driver => 'RawMemory', global => 1 );
DESCRIPTION
This is a subclass of CHI::Driver::Memory that stores references to data structures directly instead of serializing / deserializing. This
makes the cache faster at getting and setting complex data structures, but unlike most drivers, modifications to the original data
structure will affect the data structure stored in the cache, and vica versa. e.g.
my $cache = CHI->new( driver => 'Memory', global => 1 );
my $lst = ['foo'];
$cache->set('key' => $lst); # serializes $lst before storing
$cache->get('key'); # returns ['foo']
$lst->[0] = 'bar';
$cache->get('key'); # returns ['foo']
my $cache = CHI->new( driver => 'RawMemory', global => 1 );
my $lst = ['foo'];
$cache->set('key' => $lst); # stores $lst directly
$cache->get('key'); # returns ['foo']
$lst->[0] = 'bar';
$cache->get('key'); # returns ['bar']!
CONSTRUCTOR OPTIONS
Same as CHI::Driver::Memory.
SIZE AWARENESS
For the purpose of size-awareness, all items count as size 1 for this driver. (Because data structures are not serialized, there's no good
way to determine their size.)
# Keep a maximum of 10 items in cache
#
my $cache = CHI->new( driver => 'RawMemory', datastore => {}, max_size => 10 );
ACKNOWLEDGEMENTS
Thanks to Yuval Kogman whose Cache::Ref inspired me to do this.
SEE ALSO
CHI::Driver::Memory, CHI
AUTHOR
Jonathan Swartz <swartz@pobox.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-05-30 CHI::Driver::RawMemory(3pm)