473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

skip line begin with #

44
hi all

i am having a problem with reading the lines from the text file

my file look like this:

#"11-02-2008 " chief vs tumi "1234"
"12-02-2008 " duma vs duma "1254"
i am wondering if the is any function that will can help me to skip the line begin with hash.
Feb 11 '08 #1
2 2431
ronverdonk
4,258 Expert 4TB
Show (part of) the reading code, because you can either read a file 'at-once', in an array or line-by-line.

Ronald
Feb 11 '08 #2
ogo796
44
$found = "#"; // need to be serch
$lines = file.txt; //text file
if ($lines)

{

foreach($lines as $lineNumber) //loop throuhg line by line

{

$foundAMatch = preg_match("^$found", $lineNumber, $matches, PREG_OFFSET_CAPTURE);//regular expression to serch

if ($foundAMatch > 0)

{

$found = $matches[0][0];

$count=$lineNumber;


}

}
{
$str_array = explode(" ",$count);

echo $str_array[0]."<br/>";

}

else

{

$line="no file/folder found";

echo $line;

}

if you can help me to skip the line beggin with hash cause they always gives me a problem when i read from the file.
Feb 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ramon Felciano | last post by:
Hi -- I'm using the csv module to parse a tab-delimited file and wondered whether there was a more elegant way to skip an possible header line. I'm doing line = 0 reader =...
3
by: puzzlecracker | last post by:
I want to read lines and skip blank lines: would this work considering the lines can contain tabs, spaces, etc.? file.in: ------ line1 line2
59
by: AK | last post by:
I tried to google "skip scan DB2" but came up with nothing. Does DB2 have the feature under a different name?
24
by: Robin Cole | last post by:
I'd like a code review if anyone has the time. The code implements a basic skip list library for generic use. I use the following header for debug macros: /* public.h - Public declarations and...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
16
by: Adam Witney | last post by:
Hi, Is it possible for the COPY command to read data from a file, but skip specific columns? Thanks Adam
5
by: rod.weir | last post by:
Hello, I have the following code to iterate through each view in a SQL Server and call the "sp_refreshview" command against it. It works great until it finds a view that is damaged, or otherwise...
15
by: eight02645999 | last post by:
hi, how can i skip printing the last line using loops (for /while) eg for line in open("file): print line. I want to skip printing last line of the file.thanks
6
by: jimwest1995 | last post by:
Hi! I have a text file with 60 lines in it and I need to skip to line 51 to begin processing. In VB6 there was .SkipLine but I don't see that function in VB.Net. Any suggestions on how to do this?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.