10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I'm using Bash and Sed to replace text within a text file (1.txt) twice in one script. Using a for loop I'm initially replacing any 'apple' words with the variable 'word1' ("leg). I'm then using another for loop to replace any 'apple' words with the variable 'word2' ("arm"). This task is... (2 Replies)
Discussion started by: Flip-Flop
2 Replies
2. Shell Programming and Scripting
Hi
,"environment":"accent-release","build":"ac-1112_c_Alph_Nop-release_rele-1112_c_Alph_Nop-release_rele","tags":""
above is the config file, where in i want to replace value after build inside the double quotes... that value i'll be passing as parameter
for example if m passing
... (1 Reply)
Discussion started by: nikhil jain
1 Replies
3. Shell Programming and Scripting
Hi All,
I am facing a problem while using SED in Linux.
I have a property file which contains a string
local.mds.dir=${basedir}/deployCompositesIt has be to replaced with another string, and value of that string should be initialized at runtime. So I use placeholder there. My substituted... (2 Replies)
Discussion started by: bhaskar_m
2 Replies
4. Shell Programming and Scripting
Hi,
i have a file with lines,
file.txt
-------
test is fun
testing is better
I need to replace 'test' to 'develop' and i used,
a=test
b=develop
sed "s,$a,$b,g" -------- but i see the word 'testing' is also replaced. Need some solution. Is there any way i could replace only 'test' ? (4 Replies)
Discussion started by: giri_luck
4 Replies
5. Shell Programming and Scripting
I am trying to replace the line which has string "tablespace" not case senstive....
with below simple script: mysrcipt.sh
sed "s/.*/TABLESPACE USERS/g" create_table > tmp
mv tmp create_table
Is there any better way to do it? If Search string tooooooo long it will be tough to code in... (4 Replies)
Discussion started by: ganeshd
4 Replies
6. Shell Programming and Scripting
This seems like it should be an easy problem, but I'm a noob and I can't figure it out. I'm trying to use sed, but would be happy to use anything that does the job.
I am trying to trim off a fixed number of unknown characters from 2 different : delimited fields while keeping the intervening... (4 Replies)
Discussion started by: helix_w
4 Replies
7. Shell Programming and Scripting
I need to search and replace a particular string in a file. Only the exact match of the string should be replaced.
eg: File contents : abc abcd abcdef
--> Replace only 'abc' with 'xyz', but it should not replace abcd with xyzd.
So the o/p should be: xyz abcd abcdef.
How can this be done? I... (5 Replies)
Discussion started by: sngk
5 Replies
8. Shell Programming and Scripting
Hi all,
Thanks in advanced.
This question really bothered me much. What i want is to replace any times of repeated 'TB' to 'T', below is example.
It can be fullfil by AWK and perl, but my desire is using SED to realize it.
So here means we treat TB as a whole part, which means 's/TB*/T/'... (4 Replies)
Discussion started by: summer_cherry
4 Replies
9. Shell Programming and Scripting
Hi,
I have a file that I would like to translate using sed.
I can do some basic sed commands, but Im afraid this level is beyond me.
I have this file -
...alter...
..
...65536...
...
...65536...
...
...alter...
...
...65536...
etc
What I would like to do is replace the first... (11 Replies)
Discussion started by: one_ring99
11 Replies
10. UNIX for Dummies Questions & Answers
Hi
I have the following file that i need to run a sed command on
1<tab>running
2<tab>running
3<tab>running
4<tab>running
I want to be able to replace a line i.e the second one with '2<tab>failed'. As the first number is unique that can be used to search for the relevant line (using ^2 i... (5 Replies)
Discussion started by: handak9
5 Replies
SHTOOL-SUBST.TMP(1) GNU Portable Shell Tool SHTOOL-SUBST.TMP(1)
NAME
shtool-subst - GNU shtool sed(1) substitution operations
SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext]
[-e|--exec cmd] [-f|--file cmd-file] [file] [file ...]
DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files.
OPTIONS
The following command line options are available.
-v, --verbose
Display some processing information.
-t, --trace
Enable the output of the essential shell commands which are executed.
-n, --nop
No operation mode. Actual execution of the essential shell commands which would be executed is suppressed.
-w, --warning
Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution
operations resulted in no content change on all files.
-q, --quiet
Suppress warning on substitution operation resulting in no content change.
-s, --stealth
Stealth operation. Preserve timestamp on file.
-i, --interactive
Enter interactive mode where the user has to approve each operation.
-b, --backup ext
Preserve backup of original file using file name extension ext. Default is to overwrite the original file.
-e, --exec cmd
Specify sed(1) command directly.
-f, --file cmd-file
Read sed(1) command from file.
EXAMPLE
# shell script
shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch]
# RPM spec-file
%install
shtool subst -v -n
-e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g'
-e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g'
`find . -name Makefile -print`
make install
HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted
by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications.
SEE ALSO
shtool(1), sed(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)