Sponsored Content
Top Forums Shell Programming and Scripting Sed command to find, manipulate and replace a number Post 302255351 by LT_2008 on Thursday 6th of November 2008 09:44:44 AM
Old 11-06-2008
Sed command to find, manipulate and replace a number

Hi, Im very new to the world of sed so I'm really not even sure if this is possible. What i need to do is read from a flat file and every time i see this line:

VAL=123,456

I need to change 456 to 457 for every occurence of this line in the file. The numbers 123 and 456 are different for every instance of VAL. So basically i need to get VAL= skip the next value and grab the value after the "," and then add one to and subsitiute it back in.

Is it possible?

Last edited by LT_2008; 11-06-2008 at 10:53 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to use sed or perl command to find and replace a directory in a file

how to use sed command to find and replace a directory i have a file.. which contains lot of paths ... for eg.. file contains.. /usr/kk/rr/12345/1 /usr/kk/rr/12345/2 /usr/kk/rr/12345/3 /usr/kk/rr/12345/4 /usr/kk/rr/12345/5 /usr/kk/rr/12345/6 /usr/kk/rr/12345/7... (1 Reply)
Discussion started by: wip_vasikaran
1 Replies

2. Shell Programming and Scripting

Using SED to replace a random number?

Hi all, I need to run a number of scripts which have a certain phrase on them so I have identified these by; grep -l 100 *script | sort -u Normally I could just run something along the lines of; for i in `grep -l 100 *script | sort -u`; do ./${i}; done However before I run each of... (0 Replies)
Discussion started by: JayC89
0 Replies

3. Shell Programming and Scripting

sed command to find and replace

Hello All, I need a sed command to find and replace below text in multiple files in a directory. Original Text :- "$SCRIPT_PATH/files" Replace with :- "$RESOURCE_FILE" Thank you in advance !!! Regards, Anand Shah (1 Reply)
Discussion started by: anand.shah
1 Replies

4. Shell Programming and Scripting

sed find and replace command not working

Hi, Am trying to replace a character '-' with 'O' in position 289 in my file but am not success with below command. sed 's/^\(.\{289\}\)-/\1O/' filename sed: 0602-404 Function s/^\(.\{289\}\)-/\1O/ cannot be parsed. Thanks in Advance Sara Video tutorial on how to use code tags in The... (9 Replies)
Discussion started by: Sara183
9 Replies

5. Shell Programming and Scripting

sed command to skip the first line during find and replace operation

Hi Gurus, I did an exhaustive search for finding the script using "sed" to exclude the first line of file during find and replace. The first line in my file is the header names. Thanks for your help.. (4 Replies)
Discussion started by: ks_reddy
4 Replies

6. Shell Programming and Scripting

Find and replace using sed command

The content of the file filea.txt is as follows. --------- case $HOSTNAME in aaa) DS_PARM_VALUE_SET=vsDev APT_Configuration_File=/appl/infoserver/Server/Configurations/2node.apt ;; bbb) DS_PARM_VALUE_SET=vsQA... (3 Replies)
Discussion started by: kmanivan82
3 Replies

7. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

8. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

9. Shell Programming and Scripting

Help with Passing the Output of grep to sed command - to find and replace a string in a file.

I have a file example.txt as follows :SomeTextGoesHere $$TODAY_DT=20140818 $$TODAY_DT=20140818 $$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script. (It would even be better if I could pass... (5 Replies)
Discussion started by: SriRamKrish
5 Replies

10. UNIX for Dummies Questions & Answers

Using sed to replace a range of number

Trying to use SED to replace numbers that fall into a range but can't seem to get the logic to work and am wondering if SED will do this. I have a file with the following numbers 3 26 20 5. For the numbers that are greater than zero and less than 25, SED would add the word range after the... (7 Replies)
Discussion started by: jimmyf
7 Replies
XSYSTEM35(6)						       xsystem35 User Manual						      XSYSTEM35(6)

NAME
xsystem35 - program to play System 3.5 games SYNOPSIS
xsystem35 [OPTIONS] DESCRIPTION
This manual page documents briefly the xsystem35 command. This manual page was written for the Debian distribution because the original program does not have a manual page. xsystem35 is a program to run System 3.5 games. Known games are: o Kichikuou Rance o Ikenai Katsumi Sensei o Rance IV for WIN o Tshin Toshi 2 for WIN o Kaerunyo Panyon o Ikusamiko o Ningengari (in Alice no Yakata 456) o Type Zero (in Alice no Yakata 456) o ATLACH=NACHA (in Alice no Yakata 456) o DALK (in Alice no Yakata 456) o Tshin Toshi (in Alice no Yakata 456) o Dr. Stop! (in Alice no Yakata 456) o Rance I (in Alice no Yakata 456) o Rance II (in Alice no Yakata 456) o Rance III (in Alice no Yakata 456) o o DiaboLiQuE o AmbivalenZ for Win95 o Pastel Chime o Prostudent GOOD o Mamorigami-sama o Mamatoto o Hushaby Baby o DARCROWS o Persiom o o SeeIN Ao o D.P.S.? (in 20 seiki Alice) o (in 20 seiki Alice) o Only You - Re cross o Lv1.5 o Daiakuji (Not opening) o (Not opening) OPTIONS
The program start with the following options starting with one dash (`-'). A summary of options is included below. -gamefile file set game resouce file to 'file' -no-shm don't use MIT-SHM (use in another display) -devcd device set cdrom device name to 'device' -devmidi device set midi device name to 'device' -devdsp device set audio device name to 'device' /dev/dsp : oss type (device name) -O? select output audio device -Oo OSS mode -Os ALSA mode -Oe Enlightened Sound Daemon mode -O0 Disable Audio output -M? select output midi methods -Me External midi player -Mr Raw Midi device -Ms? Sequenceer device (?:devicenumber) -M0 Disable MIDI output -midiplayer cmd set external midi player to 'cmd' -devmix device set mixer device name to 'device' (effective only for oss) -devjoy device set joystick device name to 'device' if 'device' is set to 'none', don't use the device -savekanji # kanji code of filename (0 or 1 ... 0:euc, 1:sjis) -antialias always draw antialiased string (for !256 colors game) -noantialias never use antialiased string (for !256 colors game) -fullscreen start with fullscreen -noimagecursor disable image cursor -version Show version of program. -h, --help Show summary of options. FILES
${HOME}/.xsys35rc The per-user configuration file to control the behaviour of xsystem35. AUTHOR
Ying-Chun Liu <paulliu@debian.org> Wrote this manpage for the Debian system. COPYRIGHT
Copyright (C) 2010 Ying-Chun Liu (PaulLiu) This manual page was written for the Debian system (and may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or (at your option) any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. xsystem35 11/20/2011 XSYSTEM35(6)
All times are GMT -4. The time now is 07:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy