Sponsored Content
Top Forums Shell Programming and Scripting How do I change the values in a file? Post 302444006 by bartus11 on Tuesday 10th of August 2010 04:16:26 PM
Old 08-10-2010
Quote:
Originally Posted by abhijithtk
Hi Amman,

I dont use perl single liners at all. Could you tell me what the -i and the -w1pe options are??
Here you will find descriptions of all the options: http://perldoc.perl.org/perlrun.html
BTW, its "l" (lower case "L"), not "1".
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change the Values in a file

I have a data file. I want to write a shell script that reads a data file and reads position 19 thru 24. if the data in those fields is 002006, than it should change it to 002007. example: hello world hello 002006 hello world hello world hello world hello 002005 hello world hello world... (6 Replies)
Discussion started by: rudoraj
6 Replies

2. Shell Programming and Scripting

How to change values in certain column only in every line (any script)

Let say in a file I have lines of data like this : 13;2073;461496;15075341;3;001f7d3a;2042063674; 13;2074;461446;15080241;6;001ed33a;2042020154; 13;2075;461401;15085270;6;001f593b;2042054459; 13;2076;461381;15087160;6;001f7483;2042061443; 13;2077;461419;15083419;6;001eca1a;2042017818; I... (3 Replies)
Discussion started by: luna_soleil
3 Replies

3. Shell Programming and Scripting

Perl script to change values in datafiles

Hi all, Let say I have 2 files, 1 is source file and another is destination file. Source file contains the following : Kitten Dogs Donkey Chicken Turkey And destination file contains : Kitten, 0 Dogs, 0 Donkey, 0 Chicken, 0 Turkey, 0 Kitten, 0 Dogs, 0 Donkey, 0 (16 Replies)
Discussion started by: luna_soleil
16 Replies

4. Shell Programming and Scripting

How to change values in datafile from source file

Hi all, I have this source file source.txt : hdrEthernetSwitch1IPAddress 112.13.9.34 hdrEthernetSwitch2IPAddress 112.13.8.245 noOfRevASLAvailable 8000 noOfRevASLInUse 122 maxDOSPayload 7777 pcmdEvdoRUM Enabled pcmdEvdoFlow Enabled And I have this datafile to be modified : ... (5 Replies)
Discussion started by: luna_soleil
5 Replies

5. Shell Programming and Scripting

Finding change in values

I have an array X = ( -100 -90 -80 -70 -60 -50 -40 30 40 50 60 70 80 90 100 ) I want to find the place where values change from negative to positive. (8 Replies)
Discussion started by: kristinu
8 Replies

6. Shell Programming and Scripting

Change nice values of a queue

Hello Guys I need your suggestions for the below We have few unix jobs running in different queues Is there any way I can manage which jobs goes to which queue and to change their nice value as well Thanks a lot for your valuable suggestions (1 Reply)
Discussion started by: Pratik4891
1 Replies

7. Shell Programming and Scripting

How to change certain values in a file

Hi all, i need help to replace certain values in a file. I need the script to check and match the ID and exNum1. if match, values in $3 (file2.txt) need to replace the value for 'START' (file1.txt) for each match. The sample structure is like this:- File1.txt ID P_6 START ... (4 Replies)
Discussion started by: redse171
4 Replies

8. Shell Programming and Scripting

Change values in .conf file with a script

This is my first time posting here...so be gentle. Suppose I have a test.conf file that contains a value such as a IP. I would like to be able to use the Dialog Utility in Linux to allow me to enter the new IP in a Dialog form...and the results get saved into the test.conf file in the place... (4 Replies)
Discussion started by: calahanp
4 Replies

9. UNIX for Beginners Questions & Answers

How to change values in xml file?

I have xml file like below, i want change the values at default-value place of each argument name using shell script. like where argument name= protocol and default-value=tcp, where argument name =port and default-value= 7223, where argument name = username and default-value=test, example ... (12 Replies)
Discussion started by: s1s2s3s4
12 Replies

10. Shell Programming and Scripting

Change 2 values in 2 different lines

Hello all, I have a file looks like a xml file: .... <SrcIntDef>WAUXDFXXX<\SrcIntDef> <SrcIntRep>WUBGIUNXXX<\SrcIntRep> ... For these 2 lines I will change the values. So for result it should look like: ... <SrcIntDef>WUBGIUNXXX<\SrcIntDef> <SrcIntRep>WAUXDFXXX<\SrcIntRep>... (4 Replies)
Discussion started by: API
4 Replies
SHELL-QUOTE(1p) 					User Contributed Perl Documentation					   SHELL-QUOTE(1p)

NAME
shell-quote - quote arguments for safe use, unmodified in a shell command SYNOPSIS
shell-quote [switch]... arg... DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands or files with embedded white space or shell globbing characters safely. Here are a few examples. EXAMPLES
ssh preserving args When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and passes them to "$SHELL -c". This doesn't work as intended: ssh host touch 'hi there' # fails It creates 2 files, hi and there. Instead, do this: cmd=`shell-quote touch 'hi there'` ssh host "$cmd" This gives you just 1 file, hi there. process find output It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote: eval set -- `find -type f -print0 | xargs -0 shell-quote --` debug shell scripts shell-quote is better than echo for debugging shell scripts. debug() { [ -z "$debug" ] || shell-quote "debug:" "$@" } With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can. save a command for later shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are things the user can't pass through), you can do something like this: user_switches= while [ $# != 0 ] do case x$1 in x--pass-through) [ $# -gt 1 ] || die "need an argument for $1" user_switches="$user_switches "`shell-quote -- "$2"` shift;; # process other switches esac shift done # later eval "shell-quote some-command $user_switches my args" OPTIONS
--debug Turn debugging on. --help Show the usage message and die. --version Show the version number and exit. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy