sed problem any on help


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
sed problem any on help

when I execute the following expression
the sed don't work and the system don't give any error....why


if [ $d1=$d2]
then
echo "hi"
echo "$f"|sed -e 's/'"$g"'/'"$j"'/' -e 's/'"$b"'/'"$a"'/'>>file1
# 2  
what is that you are trying to achieve ?

Is the ' if ' condition set to true such that sed is getting executed ?

Could you give us an example on sample input and output ? Smilie
# 3  
Well, if g,j,b,a are having some values assigned, then your sed statements looks good to me, the output should be in the file1.

And if g,j,b,a are not having any value assined, you should get an error message like this
..
.. no previous regular expression
..

Your way of replacement is also correct, no issues.
So best will be, if you provide some more inputs to us, as matrixmadhan stated.

[jsaikia] ~ $ g="jadu";j="JADU";b="saikia";a="SAIKIA";echo jadusaikia|sed -e 's/'"$g"'/'"$j"'/' -e 's/'"$b"'/'"$a"'/'
<Output>
JADUSAIKIA

[jsaikia] ~ $ g="jadu";j="JADU";b="saikia";a="SAIKIA";echo jadusaikia|sed -e "s/$g/$j/" -e "s/$b/$a/"
<Output>
JADUSAIKIA
# 4  
hi every body
i have tow files I want to take some variable from one and replace it to the second So jaduks is right for g,j,b,a are having some values assigned

look for the example:
first file is:-

065898725 2564 26548 2654


the second file is:-
1023500002566980000032569870321011265400032113654878990000211459


so the second file is tap of data and I want to mak some change onit
by extracte spesifc part from the second file and make sume matmatical operations and then replace the result with the way I show you.

so I was confirm or trace every states so no problem except the sed command not work and not give any message


so into the program I but before the sed command echo "hi" to just conferm


so can any help

thanks in advance
# 5  
Thank Every Body

the problem solved


thanks every body
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #831
Difficulty: Easy
Asynchronous JavaScript and JSON (or AJAJ) refers to the same dynamic web page methodology as AJAX, but instead of JSON, XML is the data format.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies

2. Shell Programming and Scripting

problem with sed

Hello I want to change a string like this: echo "I don't want that we go to there" | sed 's/\//' the output now is like this: I don't to there but the output must like this: I don't want that we go to there I don' find the solution ( I'm a beginner) so maybe someone can help me with... (4 Replies)
Discussion started by: thailand
4 Replies

3. Shell Programming and Scripting

Problem with sed

I need to insert, or replace a character at a designated row and column in a text file with sed. Heres the code: sed "${row} s/./${newchar}/${col}" >test.txt Everytime I use this code on cygwin, It doesn't work, it just has me input text without an end. So why isn't it working? Also,... (35 Replies)
Discussion started by: tinman47
35 Replies

4. Shell Programming and Scripting

sed problem

Hi i am stuck with a very silly problem :mad: below is my code echo 201010_1212_121.xml i need to replace xml with csv so i did echo 201010_1212_121.xml | sed 's/.*\.xml/.*\.csv/' echo 201010_1212_121.xml | sed 's/*.xml/*.csv/' echo 201010_1212_121.xml |... (4 Replies)
Discussion started by: aishsimplesweet
4 Replies

5. Programming

sed problem

Hi all In input file I have records like this: 0,1,0,87,0,0,"6,87","170,03",0,"43,5",0,0,0,0,"6,87","126,53"and in output file I need that these records transforms in : 0 1 0 87 0 0 6,87 170,03 0 43,5 0 0 0 0 6,87 126,53 Could you help me in this case? Please (3 Replies)
Discussion started by: shizik
3 Replies

6. Shell Programming and Scripting

Sed problem

HI, I have a file test which content are as APP_NAME="%APPNAME%" Now, i m using sed command to replace the %APPNAME% with variable APPNAME. Here variable value is as export APPNAME="AB" sed -i "" -e "s:%APPNAME%:$APPNAME:" ./test test file become as APP_NAME="AB" Which is... (4 Replies)
Discussion started by: Saurabh78
4 Replies

7. Shell Programming and Scripting

Problem with sed

Hi all, I want to use sed command to search lines by line number. I give the command: #sed -n '3p;3q' Now, I don't want to use the exact value. Instead, I want to use the values of line numbers by variables. I tried using above command but that's not working. What I exactly want: ... (3 Replies)
Discussion started by: naw_deepak
3 Replies

8. Shell Programming and Scripting

Sed Problem

I have a file which contain many lines see below. "/var/www/abc>" I want to remove Both of these values "" and > (5 Replies)
Discussion started by: aliahsan81
5 Replies

9. Shell Programming and Scripting

sed problem

dear friends I am trying to execute this simple sed command but I always get an error message and I don't know why? :- sed: command garbled: /WORD/ i\ !!! code is :- #!/bin/sh sed ' /WORD/ i\ Add this line before every line with WORD ' < file can any one tell me the reason... (2 Replies)
Discussion started by: ahmad.diab
2 Replies

10. UNIX for Dummies Questions & Answers

sed problem

Hi All, I am having a text file say xyz which I convert into a file such that all the lines in that xyz file should have a on both the side of each line and \r and \n xyz which need to be converted: ============================= *%EFILocal *%EFILocal *%EFILocal *%EFILocal ... (30 Replies)
Discussion started by: gauri
30 Replies

Featured Tech Videos