Re: getting one line from file

From: Date: Thu, 31 Aug 2000 12:58:45 +0000
Subject: Re: getting one line from file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-14574@lists.php.net to get a copy of this message
pac@stingrayboats.com ("Michael Packer") writes: > I'm just learning PHP and have a question....in perl I used to do this: > > $info = grep "676" /tmp/somefile.txt; > (i know there was only one line in the file with that number, thats why it's > not @info) > > i need to only get one line out of this file that is very large (which is > why i don't want to open it read through the file until i find the correct > line)... > > how can i do this easily in PHP? > thanks in advance! > try this: :-) $info = grep "676" /tmp/somefile.txt; -robin -- Robin Vickery............................................... Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK Email: robin@planet-three.net Phone: +44 (0)870 729 5444

« previous php.general (#14574) next »