ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a 400Mb log file that was created in Win$hite and I want to remove the top X amount of lines:
I have tried things like
Code:
tail -2000 filename.log > OP.file
However I get these control characters in the OP.file that I don't seem to get the the filename.log. I originally thought that this was a windows to Linux issue so I have issued the dos2unix command but it does not work.
^ double byte characters any Idea on how to convert to single?
I don't really understand what do you mean. The od command dumps the content of a file based on the type of representation you specify. What is the output of
$ od -c drwtsn32.log | head
0000000 377 376 \r \0 \n \0 M \0 i \0 c \0 r \0 o \0
0000020 s \0 o \0 f \0 t \0 \0 ( \0 R \0 ) \0
0000040 \0 D \0 r \0 W \0 t \0 s \0 n \0 3 \0
0000060 2 \0 \r \0 \n \0 C \0 o \0 p \0 y \0 r \0
0000100 i \0 g \0 h \0 t \0 \0 ( \0 C \0 ) \0
0000120 \0 1 \0 9 \0 8 \0 5 \0 - \0 2 \0 0 \0
0000140 0 \0 2 \0 \0 M \0 i \0 c \0 r \0 o \0
0000160 s \0 o \0 f \0 t \0 \0 C \0 o \0 r \0
0000200 p \0 . \0 \0 A \0 l \0 l \0 \0 r \0
0000220 i \0 g \0 h \0 t \0 s \0 \0 r \0 e \0
If you look you can see the work M i c r o s o f t starting at line 140, it is the output of a log file generated on a windows pc, thanks trscookie.
Ok, thanks. I see now. Looking at the output of "od -c" I'm puzzled about the first two bytes. I don't know what they mean, but maybe they cause the problem (when missing) you reported in your first post.
It's hard for me to figure out a solution without managing the files by myself. Anyway, regarding the question "on how to convert to single" you can try to simply substitute the NULL character with nothing, using sed:
Code:
sed 's/\x00//g' filename > new_file
then something similar to strip the carriage returns "\r"... but as I told it's hard for me to predict the result.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.