To expand on what RudiC said; I can assure you that "\S" in a search pattern in sed means different things to different versions of the sed utility. What operating system are you using? (If you don't know, what is the output from the command: uname -a?) On your operating system, what is the full pathname of the sed utility you are using? (If you don't know, what is the output from the command: type sed?)
What does the sequence \S match with the version of sed that you are using?
Step back and explain what you are hoping to match with the pattern $att\=\S*\S when you have attribute value pairs in your sample input like:
If you feed your current script the input CustAddrState in response to the request: Enter the attribute name and New State in response to the request: enter new value, what output does your current script add to the end of your output file? Did "RJ" change to "New State"? Did it really produce the output you wanted?
I know we can substitute a string using sed but how?
For example: sed 's/(old variable)/(new variable)/ details.dat
Am I suppose to put $old variable or whatever? Because I tried many times, it didnt work by putting $old variable. Am I suppose to enclose it with "" or ''?
Please help (3 Replies)
Hi,
I have a set of files containing strings like I.TEST1_TEST2 or B.ESSA_ESSB for example.
Does somebody know how to substitute these strings whith the same name and an extension "_V1" (ie. I.TEST1_TEST2_V1) using sed command or else ? (3 Replies)
Hi ,
I am stuck up in the below scenario:-
I need to read a file name (eg A.txt) name frm another file (eg B.txt) and then I need to search for a particular expression in A.txt and substitute it with another expression.
How can I use SED inside SHELL Scripting and command prompt as... (2 Replies)
Hi ,
I am stuck up in the below scenario:-
I need to read a file name (eg A.txt) name frm another file (eg B.txt) and then I need to search for a particular expression in A.txt and substitute it with another expression.
How can I use SED inside SHELL Scripting and command prompt as well to... (1 Reply)
I have file.txt
1 4 7 9 3
I want to replace the tabs with a space, but my code doesn't work.
cat file.txt | sed 's/"\t"/ /g' > t.txt
But file is still the same. Numbers seperated by tabs instead of spaces.
Help? (2 Replies)
Hi I am trying to do a text insertion in a text file at a particular line number in a shell script. However its not working.
sed '122i\
> for j in \`echo $MyList\` ; do perl -pi -e\'s#01\/01\/2009#01\/01\/2011#\' $j ; done' $HOME/MyScript.ksh
The Actual line to be inserted at line 122... (5 Replies)
Hi,
I would like to know if there is a command similar to scsimgr in HP-UX that
can help me change the algorithm and reserve_policy attributes of all luns presented to an AIX host.
Otherwise I would have to use,
chdev -l hdiskX -a algorithm=round_robin reserve_policy=no_reserve
in a... (1 Reply)
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Hi everyone,
I need very simple sed command to change a parameter in a text file.
I have a line in this text which is like
set xx 0.5
A program reads this file and does some algebraic calculations. So to make a parameter scan I need to change the value of xx. I thought I can do... (7 Replies)
Hi,
I am trying to substitute an attributes value using sed command but it is only possible to substitute the value without space.
input xml
<BillingAddress11300000 Tag="11300000" SectionID="BLA" CustAddrName="CLAUDIA LUCIA DE ALMEIDA" CustAddrStreet="AV ENGENHEIRO RICHARD" CustAddrState="RJ"... (3 Replies)