Hi, I'm trying (my hardest) to figure this out, but I'm stumped..
I'm trying to write a php shell script that opens a text file, reads it splits it up and then puts the relevant parts into a db.. The layout of the text file is below (more or less!):
!user Desktop.ini ------------------------------------------------------ 73b
!user some help file.txt ---------------------------------------------- 4kb
!user some_random_file_naskdjasldjasdljkasdljasdljkasdljkasdljk 2kb
What i want to do is split the !user bit the actual filename and the size (dropping the ---- if they are present)..
I've look at ereg etc and can't work out how to do it.. Any ideas?
The code I've got (up till opening the file) is:
$command = "/bin/grep ! $filename >> $newfilename";
exec($command);
$fp = fopen ($newfilename, "r");
$contents = fread ($fp, filesize ($newfilename));
fclose ($fp);
(simple) but where do I go from there?
Cheers
Nut