view parts of file by offset (how to use a command such as head -c to start later)
I am trying to figure out which character is creating a problem for another program (back in windows).
I get an error that there is an "Invalid character in the given encoding. Line 2, position 2841914. The 40mb file only has two lines (first line only has a few characters, second has almost all), as all of the new line separators were removed from the file. I am used to being able to use a command such as 'head -c K filename.txt' to view a part of the file, but how do i tell head to start reading the file instead at line 2, position 2841914? Thanks! Doug |
tail -c +2841915 filename.txt
|
Quote:
Now, for the part I didn't ask: turns out there are some truly invalid characters: part of the line shows up as 26 04 then two question marks with black backgrounds a letter E, error question mark, T, then another error question mark, and then a \. Is there any way to replace (regular expression I assume) these error characters? So, convert "26 04??E?T?\" to "26 04000000"? Thanks again |
How about "cat filename.txt | head -c2 | cut -b2841914-2841915"?
|
Quote:
|
please note that I will also need to remove the "\" in addition to the illegal characters.
|
Perhaps not elegant, but you can always use a hex editor such as hexedit or bpe or mc or khexedit or okteta or ...
|
All times are GMT -5. The time now is 10:52 PM. |