• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

logfile extract to text

hello,
here a code to extract log file to text file
*********
ftp_get($ftp_link[$x],"./logs/$logs[$y]-$servers[$x].txt","/usr/monitoring/$logs[$y].log", FTP_ASCII);
$file[$x][$y] = file("./logs/$logs[$y]-$servers[$x].txt");
*************
but the problem the text file add blank line between each line is there anyway to remove this lines or to extract only text without blanks
Thanks for your help

vi chk_df.log
/dev/sda2              2585332     51952   2402052   3% /home
/dev/sda3               194449     10823    173586   6% /boot
/dev/sda5             10072456   2927076   6633712  31% /usr
/dev/sda7              2063504   1004720    953964  52% /
/dev/sda8              1035660     33052    950000   4% /tmp

text file

/dev/sda2              2585332     51952   2402052   3% /home

/dev/sda3               194449     10823    173586   6% /boot

/dev/sda5             10072456   2927072   6633716  31% /usr

/dev/sda7              2063504   1004720    953964  52% /

/dev/sda8              1035660     33024    950028   4% /tmp
0
usmbay
Asked:
usmbay
1 Solution
 
jonathanmelnickCommented:
I believe your LF (unix) returns are for some reason getting converted to CRLF (Dos)...

Try using FTP_BINARY instead of FTP_ASCII, so that would now read :


ftp_get($ftp_link[$x],"./logs/$logs[$y]-$servers[$x].txt","/usr/monitoring/$logs[$y].log", FTP_BINARY);
$file[$x][$y] = file("./logs/$logs[$y]-$servers[$x].txt");
0
 
usmbayAuthor Commented:
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now