Hi i want to remove a load text.
current output
<load>Full Load</load>
desired output
Full Load
Hi i want to remove a load text.
current output
<load>Full Load</load>
desired output
Full Load
sed 's;</\?load>;;g' file
Emanuele
That is fine but it show text like that.
current output
Full Load
desired output
Full Load
Then your input is not what you showed us in the first post. Post the input data that you are using to get that result.
I am sorry actually i am processing earlier first time one file then it was showing perfectly, but i need to process other files so it is showing space.
current output
<load>Full Load</load> -> file1
<load> Full Load</load> -> file2
desired output
Full Load
Full Load
Modification of targzeta's solution:
sed 's;</\?load>[\t ]*;;g' file
Not working. I have tried this.
Please post your input file contents and desired output .
Try:
sed 's|</\{0,1\}load>[[:blank:]]*||g' file
--
Note: \?
, \|
and \t
are GNU sed only.
Here's another sed solution:
sed 's/\(<load>\|<\/load>\)//g; s/^[ \t]*//' file*.txt
Not working. Space is still there and also load is also there.
---------- Post updated at 07:22 AM ---------- Previous update was at 07:20 AM ----------
This one is working.
sed 's;</\?load>[[:space:]]*;;g' file
Emanuele
How can this be? You provided this input:
<load>Full Load</load>
<load> Full Load</load>
With regular sed:
$ sed 's|</\{0,1\}load>[[:blank:]]*||g' file
Full Load
Full Load
And with GNU sed
$ gsed 's|</\{0,1\}load>[[:blank:]]*||g' file
Full Load
Full Load
So which input file are you using? It seems to me that your input sample does not correspond to your actual data...
What is is your OS and version?
with multiple files:
$ cat file1
<load>Full Load</load>
$ cat file2
<load> Full Load</load>
$ sed 's|</\{0,1\}load>[[:blank:]]*||g' file[12]
Full Load
Full Load