Welcome to Coding : Sécurité Programmation Réseaux

Search   in  

 Create an Account Home | Submit News Your Account Content | Topics | Top 10  


Accueil
· Home
· Listing des Articles
· Top 10
· Repository des Exploits

Les sujets / parties
· C / C ++
· Visual Basic
· Asm
· Reseaux
· Java
· Securite
· Divers

Utile
· Listing des Articles

· Telecharger
· Le Forum
· Liens
· Proposer un article

Top20 des Downloads
· 1: Etude des reseaux generalites et protocoles
· 2: Cheval de troie en VB avec sources
· 3: Netcat 1.1
· 4: Keylogger
· 5: Etudes des reseaux hauts debits architectures et protocoles
· 6: Ecoute de port
· 7: Etude du Smart Spoofing
· 8: Win Packet Capture Utils
· 9: Tutorial on Traffic Interception on Switched Lan using ARP spoofing
· 10: Cours de C

User Info
Welcome, Anonymous
Nickname
Password
(Register)
Membership:
Latest: gold-os
New Today: 0
New Yesterday: 1
Overall: 2179

People Online:
Visitors: 35
Members: 0
Total: 35

  
Coding : Sécurité Programmation Réseaux: Forums

Coding :: View topic - dynamic editing using shell script
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

dynamic editing using shell script

 
Post new topic   Reply to topic    Coding Forum Index -> Scripting
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu May 15, 2008 1:10 pm    Post subject: dynamic editing using shell script Reply with quote

Hi,

I would like to edit an input data-file by changing a variable in it
in steps:

For ex: If my input file is 'big.in', then it has the following data:

2.54 0.01 0.5 0.0

My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...

I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...

Any help would be appreciated

Thanks
Ravi
Back to top
mop2
Guest





PostPosted: Thu May 15, 2008 1:10 pm    Post subject: Re: dynamic editing using shell script Reply with quote

habzone2...@gmail.com wrote:
Quote:
Hi,

I would like to edit an input data-file by changing a variable in it
in steps:

For ex: If my input file is 'big.in', then it has the following data:

2.54 0.01 0.5 0.0

My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...

I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...

Any help would be appreciated

Thanks
Ravi


Here I was using bash:

$ echo -e '2.54\t0.01\t0.5\t0.0' >big.in

$ a=;b=;c=;d=;read a b c d <big.in

$ echo $a - $b - $c - $d
2.54 - 0.01 - 0.5 - 0.0

$ x=0.01
echo b=$b;b=`echo $b+$x|bc`;echo b=$b
$ echo b=$b; b=`echo $b+$x|bc`; echo b=$b
b=0.01
b=.02
$
Back to top
mop2
Guest





PostPosted: Thu May 15, 2008 1:10 pm    Post subject: Re: dynamic editing using shell script Reply with quote

habzone2...@gmail.com wrote:
Quote:
Hi,

I would like to edit an input data-file by changing a variable in it
in steps:

For ex: If my input file is 'big.in', then it has the following data:

2.54 0.01 0.5 0.0

My source code then reads this above line, executes and gives out some
output. Then ,
I want to increment the value "0.01" in the above file by some step
and the source code reads it again, executes and gives another output
and so on...

I can use Finding & replacing (ex: 's/0.01/0.02/g') to replace a
previous value, but if there are 100 values I need to substitute, it
becomes cumbersome..there must be a better way, like using a variable
for finding and replacing...

Any help would be appreciated

Thanks
Ravi


Here I was using bash:

$ echo -e '2.54\t0.01\t0.5\t0.0' >big.in

$ a=;b=;c=;d=;read a b c d <big.in

$ echo $a - $b - $c - $d
2.54 - 0.01 - 0.5 - 0.0

$ x=0.01
$ echo b=$b; b=`echo $b+$x|bc`; echo b=$b
b=0.01
b=.02
$
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Coding Forum Index -> Scripting All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.36 Seconds