Sponsored Content
Operating Systems Linux Linux command to find and replace occurance of more than two equal sign with "==" from XML file. Post 302659595 by bakunin on Thursday 21st of June 2012 07:58:11 AM
Old 06-21-2012
Quote:
Originally Posted by RedRocks!!
I need a command that will work on file (xml) and replace multiple occurrence (more than 2 times)

should be replaced by just '=='
Note :- single character should be replaced. (= should be replaced by ==)

I have used this command:-
Code:
sed 's/==*/==/g' example.xml > example.xml

But after using this command i found, where single character = is there, it changes into ==
Seems to me that this is what you wanted, isn't it?

If you only want to replace two or more occurences of "=" use:

Code:
sed 's/===*/==/g' example.xml > example.xml.result

You cannot direct the output of sed to the input file, because that would overwrite and destroy the input file after the first line. Therefore a different output file name.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

2. Shell Programming and Scripting

Interesting question - Search and replace the word after sign "="

Hi Guys, Req your help in searching and replacing the word that comes after equals(=) symbol I would like to replace the sting in bold with a string in variable. d=ABCDF8C44C22 # grep -i NIM_MASTERID ${_NIMINFO} export NIM_MASTERID=00CDF8C44C00 I'm looking to replace any word that... (4 Replies)
Discussion started by: ajilesh
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. UNIX for Dummies Questions & Answers

replace "," with "." only in specific columns of a file?

Hi all, I have this text file containing 9 columns separated by space. The 8th columns contains the numbers. C1 C2 C3 C4 C5 C6 C7 C8 C9 er rt yt gh iu nk il 0.07 xs yt lr ty bg iu zk nh 0,0005 lt ...etc. I want to replace the comma with full stop only in 8th coloumn. the output... (8 Replies)
Discussion started by: Unilearn
8 Replies

5. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

6. Ubuntu

How to change "more" to "more or equal" in this line?

Hi, Below line selects only dates comes after than today. I need to change below line as "more or equal": awk -F\## -v d=$(date +%Y%m%d) '{if($NF>d)print}' /usr/batch/pill.txt > /usr/batch/pill_in_use.txt When we change the code, it will print today's date and following dates only. ... (2 Replies)
Discussion started by: baris35
2 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies

9. UNIX for Beginners Questions & Answers

How do I redirect output from "find", either to a file or another command?

I'm trying to find out what happened to the rogue game that apt-get told me it installed, so I thought I would find the file. I went to the root and entered: find -name "rog*.*" I get a large number of lines saying my access is denied in various directories. I figure I'll practice my Unix... (14 Replies)
Discussion started by: arghvark
14 Replies
XML-XREAD(1)							   User Commands						      XML-XREAD(1)

NAME
xml-xread - Parse XML documents with entity and URI resolution SYNOPSIS
xml-xread [options] xmlfile DESCRIPTION
xml-xread is a simple command line tool for parsing and validating XML documents. It is not an actual XML parser, it just wraps around a JAXP XMLReader, adding support for catalog-based entity and URI resolution. OPTIONS
-c catalogfile Load a particular catalog file. May be specified multiple times. -v Perform a validating parse. This is the default. -w Perform a well-formed parse, not a validating parse. -N Perform a namespace-aware parse. This is the default. -n Perform a namespace-ignorant parse. -d debuglevel Set the debug level (an integer). Warnings are shown if the debug level is set to greater than 2. -E maxerrors Set the maximum number of errors to display. The default is 10. FILES
/etc/java/resolver/CatalogManager.properties The central catalog manager configuration file used by xml-xread. SEE ALSO
xml-parse(1), xml-resolver(1), java(1), the OASIS entity resolution technical committee home page at <http://www.oasis-open.org/commit- tees/entity/>. AUTHOR
Norman Walsh <Norman.Walsh@Sun.COM> 1.1 July 2004 XML-XREAD(1)
All times are GMT -4. The time now is 04:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy