sed command not working for me to change text in a file
UNIX gurus
I need your help with the following (The server is an AIX box).
I have a text file with the following information:
I need to change the lines starting with : and replace them with *). For example:
I wrote the following code to get this done, but it's not working, only the last line gets changed, From :WORD3 to WORD3*), the other two (:WORD1 and :WORD2) don't get changed.
*********************************************************
I believe the last "sed" command is missing something. Up to that point, the script works fine as shown below. However, when I change on the target file ($TWSTARGETFILE2) as explained above only the last occurrence (:WORD3) gets changed (to WORD3*), but not the 1st (:WORD1) or 2nd (:WORD) occurrence.
Thanks for your help on this.
Martin.
Last edited by Scrutinizer; 02-02-2017 at 01:19 AM..
Reason: code tags
Hello There -
Iam trying to get this expdp running for oracle backup.
And this is the code below:
### Run the export.
### Comment out any LOGFILE parameters in the .par file.
if grep -i "Logfile" /<Path>$1_$2_$3.par; then
## Comment out any LOGFILE... (7 Replies)
cat bipin.txt
Unix is an OS
Unix has its own commmands
Unix is a user friendly OS
Unix is platform independent
Unix is a time sharing OS
the best OS to learn is Unix
Abinitio uses Unix in backend
this is my file
when i use sed 's/Unix/Linux/' bipin.txt all the occurences are getting... (0 Replies)
I have a simple task to replace unix line feed end of line characters with carriage returns.
When I run the following “change file in place” sed instruction from the command line all the Line feeds are successfully replaced with Carriage returns.
sed -i 's/$/\r/' lf_file.txt
But that same... (1 Reply)
Hi All,
I am trying to run a sed command to replace a string in a file.
sed -i -e "s/$Job_status_old ,$line/Job_status_new ,$line/g" stat.txt
The command wen run from the command promt works fine.
But the same command does not work when its put in a script.
The script is not failing... (3 Replies)
Hi guys,
the command is
echo "Online Memory : 32768 MB" | sed 's/.*\(+\).*/\1/'
I would expect it to print 32768, it cuts off any character to the first digit, then gets all digits in 1, cuts off the rest after the digits, and should print 32768, instead it... (4 Replies)
Hello, I recently sought help on another thread about how to prefix 2 words in a file with 'pack/'. This is the command:
sed --in-place 's/"\(libraries\|objects\)"/"pack\/\1"/g'
Background: I have a .json file with the word 'libraries' and 'objects' in it. However, 'libraries' occurs twice;... (6 Replies)
Hello,
I have sed to change improperly entered email address such as:
blank@blank.co --> blank@blank.com (it should be)
I am using this:
sed 's/blank.co/blank.com/g'
Problem is it makes good ones already blank.com becomes blank.comm which is incorrect.....
It should only match *@.co... (3 Replies)
Hello All,
I need to extract lines from a file that contains ALPHANUMERIC and the length of Alphanumeric is set to 16. I have pasted the sample of the lines from the text file that I have created.
My problem is that sometimes 16 appears in other part of the line. I'm only interested to... (14 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)