OESF Portables Forum
Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: daniel3000 on June 02, 2006, 10:01:49 am
-
Hello,
is there a tool which is able to find a given byte sequence in a file and delete that sequence?
I mean something like sed for binary files, I need to do something like
sed -e '/3C 00 75 00 6C 00 3E 00 0A 00 09 00 09 00 3C 00 2F 00 75 00 6C 00 3E/d'
(I know this won't work, as sed does not do byte-level editing, it's only an example in a kind of pseudo code).
My problem is this:
I want to process a text file this way, so sed would actually be the tool to choose. But the string I want to delete contains a newline, and even with the N command of sed I was not able to create a suitable sed command.
So now I'm looking for something which works on the byte level.
Thanks for any hint
daniel
-
Hello,
is there a tool which is able to find a given byte sequence in a file and delete that sequence?
I mean something like sed for binary files, I need to do something like
sed -e '/3C 00 75 00 6C 00 3E 00 0A 00 09 00 09 00 3C 00 2F 00 75 00 6C 00 3E/d'
(I know this won't work, as sed does not do byte-level editing, it's only an example in a kind of pseudo code).
My problem is this:
I want to process a text file this way, so sed would actually be the tool to choose. But the string I want to delete contains a newline, and even with the N command of sed I was not able to create a suitable sed command.
So now I'm looking for something which works on the byte level.
Thanks for any hint
daniel
[div align=\"right\"][a href=\"index.php?act=findpost&pid=129469\"][{POST_SNAPBACK}][/a][/div]
try with "tr -d ..."
-
or awk if you have it in your distro
-
I recently had a similar problem at work, replacing text that contained newlines. I did manage to get it working with sed. I found some examples online that helped.
When I get to work monday, I'll look it up and post my example, if you haven't found an answer by then
-
if you want to remove a complete line from a text file, you ca also simply use grep,
ie
grep -v "some text" ....
-
if you want to remove a complete line from a text file, you ca also simply use grep,
ie
grep -v "some text" ....
[div align=\"right\"][a href=\"index.php?act=findpost&pid=129570\"][{POST_SNAPBACK}][/a][/div]
Hi Meanie,
I want to remove two lines of text, but only if the first one only contains " <ul>\n" and the second one only contains " </ul>\n". That can occur many times in the source file.
I found bbe, which is a stream editor similar to sed, but works on binary sequences.
I'll use that one I think, since the byte sequence is alweays the same, it can be handled nicely with bbe.
bbe compiled nicely on the Zaurus.
Seems to be a useful too,. I'll make an IPK soon.
There is another approach to solve this problem, because the source file is generated from an XML using XSLT. So if I find a way to prevent the XSLT to generate these empty <ul>s, this would be of course the more elegant solution.
But I have no clue how to do this. Have asked in some XML/XSLT forums. Maybe this will bring a working solution.
Thanks so far!
daniel