![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix script to convert .csv file to.xls format | moon_friend | UNIX for Dummies Questions & Answers | 1 | 12-08-2008 07:09 AM |
| steps to convert .pc file to .sh file in unix | user71408 | Shell Programming and Scripting | 2 | 05-23-2008 03:52 AM |
| How to convert Unix executable file to Tiff | Pet Teoh | UNIX for Dummies Questions & Answers | 1 | 09-28-2007 06:08 AM |
| Sample Unix script file to convert .xml to .csv | srinivasaphani | Shell Programming and Scripting | 4 | 08-27-2007 11:04 AM |
| How to convert binary Unix file to text | user12345 | UNIX for Dummies Questions & Answers | 5 | 11-10-2006 06:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to convert a .log file into .txt file under unix??
Hi Friends,
I have a .log file generated from a tool(Windows PC) which can be opened using a notepad, but when I tried to view the file in unix (cygwin on my laptop) the file type is showing as binary file, So I am unable to process the file. I need to extract some of the selected text from the file using grep. Can any one help me to solve this problem by providing the script to convert this file to .txt file in unix itself to avoid the time waste in opening the file in windows and saving it as .txt and opening it unix and processing it further. Find my file in the attachment. I have hundreds of file like this. Any help in this regard is highly aprreciable. Thanks.. -----Post Update----- I just renamed the file to .txt extension as I am unable to upload in this forum. Don't get confuse with this. It is originally a .log extension file. |
|
||||
|
I don't have problem opening it in cygwin. Looks like your file is messed up - a null character is inserted every other position (od -c File1.txt). I think the file was not generated properly.
Note, unix doesn't have the concept of file extensions. All it cares about is what is inside. Also windows and unix handle line breaks differently (windows uses 2 characters, unix 1), so you can't just copy directly a text file b/w the two. If using ftp, you'll need to use ascii mode so it will take care the conversion for you. Or, you can use the command dos2unix to convert the wrongly transfered windows text file to unix format on unix. -----Post Update----- tr -sd '\0' '' < File1.txt > newfile That is how to get rid of the null characters. To convert it to true unix format, dos2unix newfile -----Post Update----- tr -sd '\0' '' < File1.txt > newfile That is how to get rid of the null characters. To convert it to true unix format, dos2unix newfile |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|