09-20-2010
Script to open a saved file and modify the content
I am looking for a script where I need to open a file and modify the data like changing the parameters.Can anyone help me?
open a file software.rsp . It already contains following data.
parameter = false
threads=100
user= demf
The above should be changed to
paramter=true
thread= 133
user = deefs
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi all, any ideas how we can permanently modify the open files?
bash-2.03$ ulimit -a
core file size (blocks) 0
data seg size (kbytes) unlimited
file size (blocks) unlimited
open files 256 <---------------
pipe size (512 bytes) 10
stack size... (2 Replies)
Discussion started by: 3rr0r_3rr0r
2 Replies
2. Shell Programming and Scripting
Hi,
i am using SuonOS and ksh.
i need to add data into a file(s.txt) using a shell script. i have to pass 3 parameters and these 3 paramaters should add into the file at end of the file.
File s.txt is look like,
---------------------------------
column1|column2|column3
... (1 Reply)
Discussion started by: syamkp
1 Replies
3. Shell Programming and Scripting
Hi ! All
I want to write a script where, it will open a new shell with a
username / pwd and modify a file of same username and exit.
example:
1. UserA
2. UserB- FileB
ScriptA -> su UserB -> Modify FileB -> Exit ScriptA
Can somebody give me a direction , on how to... (2 Replies)
Discussion started by: dashok.83
2 Replies
4. Shell Programming and Scripting
Hi,
Can anyone pls let me know how can i modify the file contents thru script.
Eg.
I have file abc.dat that contains below lines
Merge.resync.cycleFlag
Merge.resync.logFlag
Merge.resync.maxByteRate
Merge.resync.maxSearch
Merge.resync.rate
Merge.resync.tickLog ... (2 Replies)
Discussion started by: sdosanjh
2 Replies
5. UNIX for Dummies Questions & Answers
Hi ,
Script File Is Not Getting Saved This Are The Steps I Am Following For Saving And Executing A Script
1). vi ( To Open Vi Editor )
2). vi filename ( vi firstprog.ksh)
#!bin\kash
date
3) !wq :( Saving And Quit) When I Am Saving The Scrpit I Am Getting The Below... (1 Reply)
Discussion started by: anudeepkumar123
1 Replies
6. Shell Programming and Scripting
Hi All,
I have an input file like below,
6984 1225
6989 1220
6994 1214 ... (3 Replies)
Discussion started by: Indra2011
3 Replies
7. Shell Programming and Scripting
Hi All the Helpers!
I have a text file which looks like input.txt.I would request to please suggest me how can I make this file look like output.txt
input.txt
VOP 111 0 1 2
DEM 111 0 222 333 444 555
879 888 987 888 989
VOP 118 0... (2 Replies)
Discussion started by: Indra2011
2 Replies
8. Shell Programming and Scripting
Hi All the Helpers!
I have a text file which looks like input.txt.I would request to please suggest me how can I make this file look like output.txt
input.txt
VOP 111 0 1 2
DEM 111 0 222 333 444 555
DEM 879 888 987 888 989
DEM 879 888 987 888 989
VOP 118 0 12 3 6... (7 Replies)
Discussion started by: Indra2011
7 Replies
9. Shell Programming and Scripting
I have the below contents in a file after making the below curl call
curl ... | grep -E "state|Rno" | paste -sd',\n' | grep "Disconnected" > test
"state" : "Disconnected",, "Rno" : "5554f1d2"
"state" : "Disconnected",, "Rno" : "10587563"
"state" : "Disconnected",, "Rno" :... (2 Replies)
Discussion started by: Vaibhav H
2 Replies
10. UNIX for Beginners Questions & Answers
Hello everybody,
I would like modify some strings using sed or another command line with the content file.
For example:
- {fqdn: "server-01" , ip: "server-01"}
- {fqdn: "server-02" , ip: "server-02"}
- {fqdn: "server-03" , ip: "server-03"}
- {fqdn: "server-04" , ip: "server-04"}
My... (4 Replies)
Discussion started by: dco
4 Replies
LEARN ABOUT DEBIAN
filehandle::fmode
Fmode(3pm) User Contributed Perl Documentation Fmode(3pm)
NAME
FileHandle::Fmode - determine whether a filehandle is opened for reading, writing, or both.
SYNOPSIS
use FileHandle::Fmode qw(:all);
.
.
#$fh and FH are open filehandles
print is_R($fh), "
";
print is_W(*FH), "
";
FUNCTIONS
$bool = is_FH($fh);
$bool = is_FH(*FH);
This is just a (more intuitively named) alias for is_arg_ok().
Returns 1 if its argument is an open filehandle.
Returns 0 if its argument is something other than an open filehandle.
$bool = is_arg_ok($fh);
$bool = is_arg_ok(*FH);
Returns 1 if its argument is an open filehandle.
Returns 0 if its argument is something other than an open filehandle.
Arguments to the following functions must be open filehandles. If
any of those functions receive an argument that is not an open
filehandle then the function dies with an appropriate error message.
To ensure that your script won't suffer such a death, you could first
check by passing the argument to is_FH(). Or you could wrap the
function call in an eval{} block.
Note that it may be possible that a filehandle opened for writing may
become unwritable - if (eg) the disk becomes full. I don't know how
the below functions would be affected by such an event. I suspect
that they would be unaware of the change ... but I haven't actually
checked.
$bool = is_R($fh);
$bool = is_R(*FH);
Returns true if the filehandle is readable.
Else returns false.
$bool = is_W($fh);
$bool = is_W(*FH);
Returns true if the filehandle is writable.
Else returns false
$bool = is_RO($fh);
$bool = is_RO(*FH);
Returns true if the filehandle is readable but not writable.
Else returns false
$bool = is_WO($fh);
$bool = is_WO(*FH);
Returns true if the filehandle is writable but not readable.
Else returns false
$bool = is_RW($fh);
$bool = is_RW(*FH);
Returns true if the filehandle is both readable and writable.
Else returns false
$bool = is_A($fh);
$bool = is_A(*FH);
Returns true if the filehandle was opened for appending.
Else returns false.
Not currently implemented on Win32 with pre-5.6.1 versions of perl (and
dies with appropriate error message if called on such a platform).
CREDITS
Inspired (hmmm ... is that the right word ?) by an idea from BrowserUK
posted on PerlMonks in response to a question from dragonchild. Win32
code (including XS code) provided by BrowserUK. Zaxo presented the idea
of using fcntl() in an earlier PerlMonks thread.
Thanks to dragonchild and BrowserUK for steering this module in
the right direction.
Thanks to attn.steven.kuo for directing me to the perliol routines
that enable us to query filehandles attached to memory objects.
And thanks to Jost Krieger for helping to sort out the test failures that
were occurring on Solaris (and some other operating systems too).
TODO
I don't know that anyone still runs pre-5.6.1 perl on Win32. However, if
someone likes to tell me how is_A() could be made to work on pre-5.6.1
Win32 perl, I would be quite happy to implement it.
LICENSE
This program is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.
Copyright 2006-2008, Sisyphus
AUTHOR
Sisyphus <sisyphus at cpan dot org>
perl v5.14.2 2008-09-26 Fmode(3pm)