How do you find the number of lines in a file?

I need to count how many lines there are in a file, I am using a BufferedReader to read in the data, but how can I find the number of lines?
Thanks

That depends. How do you define a line? Is it a specific number of
characters, a String that's terminated by a newline character or some
combination thereof?

Similar Messages

  • How do you find the number of songs in your library, more importantly the number of duplicates, this new version is very lacking in access to info

    I do not like the interface of the new version.  I lost a lot of playlists and songs in the iMatch process.  As I attempt recovery from backups,  I am trying to identify how many duplicates I have in total. I can get a list, but there are too many to count.  There  has to be a better way.
    thanks

    View > Show Status Bar puts the grey bar at the bottom where song/playlist stats are displayed
    In itunes 11 the Show duplicates feature was omitted.
    However in iTunes 11.0.1 they put it back
    from the top menu
    View > Show Duplicates
    or
    Option(alt) + View > Show Exact duplicates

  • How do you find the iPad phone number for cellular data?

    How do you find the iPad phone number for cellular data?

    I know this post was a long time ago but people still seem to be viewing it.
    Quickest way:
    Via the iPad on 3G, go to http://m.telstra.com. The service number is then displayed and you are given the option to recharge.

  • How do I increase the number of lines presented in a drop down list?

    When I am entering a single character/number for each of a random selection of three letters in a password verification, I get a drop down list from A to S only, the first 20. Accessing letter T to number 9 means scrolling down. How can I increase the number of lines in a drop down box to 36?

    Hi canddski,
    If you are taking about an interface on a website, this is up to the ui designer. But there is a reflow that depends on screensize for the Firefox UI.
    You can use asp to control the list:
    [http://forums.asp.net/t/1970301.aspx?How+can+i+display+selected+no+of+records+from+datatable+using+dropdown+list+without+database+]
    but also try asking on stackoverflow.com

  • How do I find the number of physical CPUs , number of cores in OEL ?

    In RHEL , it is easy to find the number of Physical CPUs and the number of cores within each CPU
    -- Ouput from Red Hat Enterprise Linux 5.4
    -- This a real machine. Not a VM
    $ cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 46
    model name      : Intel(R) Xeon(R) CPU           X7550  @ 2.00GHz
    stepping        : 6
    cpu MHz         : 1995.048
    cache size      : 18432 KB
    physical id     : 0              --------------> This will give info on the physical CPU
    siblings        : 8
    core id         : 0
    cpu cores       : 8              --------------> This will give the number of cores within a CPU
    apicid          : 0
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 11
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm
    bogomips        : 3990.09
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 44 bits physical, 48 bits virtual
    power management: [8]Output from Oracle Linux . Physical CPU Id and Number of Cores info is missing.
    -- Output from Oracle Enterprise Linux 6.3
    -- This is a virtual machine created using Virtual Box
    -- Processor ID , number of cores is missing
    $ cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 42
    model name      : Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
    stepping        : 7
    cpu MHz         : 2298.627
    cache size      : 6144 KB
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc up rep_good nopl pni monitor ssse3 lahf_lm
    bogomips        : 4597.25
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 36 bits physical, 48 bits virtual
    power management:Is this the expected output in Oracle Enterprise Linux ? If so, how can I find the number of Physical CPUs and the number of cores within a Physical CPU in OEL?
    Is this info missing because I am running OEL in a virtual machine ?

    Oracle Linux behaves exactly like Red Hat in this matter an /proc/cpuinfo can be used for that. I guess this is because you have set up VirtualBox to only assign one virtual CPU to your guest Linux.
    processor     : 0
    vendor_id     : AuthenticAMD
    cpu family     : 15
    model          : 33
    model name     : Dual Core AMD Opteron(tm) Processor 275
    stepping     : 2
    cpu MHz          : 1000.000
    cache size     : 1024 KB
    physical id     : 0
    siblings     : 2
    core id          : 0
    cpu cores     : 2
    apicid          : 0
    initial apicid     : 0
    fpu          : yes
    fpu_exception     : yes
    cpuid level     : 1
    wp          : yes
    flags          : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow rep_good extd_apicid pni lahf_lm cmp_legacy
    bogomips     : 1994.47
    TLB size     : 1024 4K pages
    clflush size     : 64
    cache_alignment     : 64
    address sizes     : 40 bits physical, 48 bits virtual
    power management: ts fid vid ttpAnother example is this one, OEL 5.6 inside of VirtualBox but with 2 virtual CPUs assigned:
    [root@oel56proxy ~]# cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 23
    model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
    stepping        : 10
    cpu MHz         : 2064.652
    cache size      : 6144 KB
    physical id     : 0
    siblings        : 2
    core id         : 0
    cpu cores       : 2
    apicid          : 0
    fdiv_bug        : no
    hlt_bug         : no
    f00f_bug        : no
    coma_bug        : no
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc pni ssse3 lahf_lm
    bogomips        : 4129.30
    processor       : 1
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 23
    model name      : Intel(R) Core(TM)2 Duo CPU     P8600  @ 2.40GHz
    stepping        : 10
    cpu MHz         : 2064.652
    cache size      : 6144 KB
    physical id     : 0
    siblings        : 2
    core id         : 1
    cpu cores       : 2
    apicid          : 1
    fdiv_bug        : no
    hlt_bug         : no
    f00f_bug        : no
    coma_bug        : no
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 5
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc pni ssse3 lahf_lm
    bogomips        : 7494.15I have not tried to replicate this with a VM that only has one vCPU assigned but I guess that is why you only see one CPU and no processor_id and so on.
    Bjoern

  • How do I find the number of users returned by a cfldap query?

    How do I find the number of users returned by a cfldap query?
    I'm not allowed to do something like:
    <cfif ArrayLen(results.rows) gt 1>
    I then get an error:
    faultCode:Server.Processing faultString:'Unable to invoke CFC - Object of type class coldfusion.tagext.net.LdapResultTable cannot be used as an array' faultDetail:''
    Many thanks for any light you can shed

       Cheers again Ian for your many helps,
    it now won't let me do
    <cfqueryparam value="#results.USNCreated#" cfsqltype="cf_sql_varchar">
    I get the message:
    faultCode:Server.Processing faultString:'Unable to invoke CFC - Error Executing Database Query.' faultDetail:'[Macromedia][SQLServer JDBC Driver][SQLServer]The name "results.USNCreated" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.'

  • How do I find the number of contacts in a smart group?

    How do I find the number of contacts in a smart group in Contacts?

    Hi,
    To get the depth using JMS you must create a QueueBrowse and browse the entire queue. Its generally horribly inefficient if you want to do it with any regularity.
    In Hermes I have had to write plugins that open separate connections to providers using their non-JMS APIs or JMX and get that kind of information that way.
    Look at the getDepth() method in this JBoss plugin for an example that uses JMX:
    http://cvs.sourceforge.net/viewcvs.py/hermesjms/Hermes4/src/java/hermes/ext/jbossmq/JBossMQAdmin.java?view=markup
    And here is one for WebSphereMQ that uses one of its many APIs..
    http://cvs.sourceforge.net/viewcvs.py/hermesjms/Hermes4/src/java/hermes/ext/mq/MQSeriesAdmin.java?view=markup
    Colin.
    http://hermesjms.com

  • How do you control the number of rings before voic...

    When people call me, Skype rings far to many times before voice mail comes on.  How do you reduce the number of rings on an inbound call, so that voice mail comes on in 4 to 5 rings?

    Hi, billwalker1125,
    Skype does not determine when to send calls to voice mail by the number of rings, but instead by the amount of time that has elapsed.  Check your settings (in Windows, it would be Tools -> Options -> Calls -> Voice Messages -> Start recording a voice message if ...   Remember to Save your changes!
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How do you find the word count on MacBook, please?

    How do you find the word count on MacBook, please?

    If you are trying to find word count in a Microsoft Word 2011 documemt, for instance, open the document and go to the Tools menu, selecting Word Count. In Apple's Pages application, open the document and look at the bottom of the page, near the left it will say "X Words" where X is the number.
    Best of luck.

  • How do you show the number of days per month?

    How do you show the number of days per month?
    I am working on a budget.  I want to know how much to amortize each month to fund an investment.  Income comes monthly, but expenses leave in days, or weeks.  The number of days and weeks in months vary. 
    I want to figure out income and expenses per day, per month and per year, so I know how much can be invested each month, week or day.  For a start I would like a formula that shows how many days are in each month?

    thanks..
    I solve my problem as
    public class MyExample {
        public static void main(String a[]) {
            String stdate = "2009-03-01";
            java.sql.Date currentDate = new java.sql.Date(System.currentTimeMillis());
            java.sql.Date preDate = java.sql.Date.valueOf(stdate);
            System.out.println(currentDate);
            System.out.println(preDate);
    //        int dateCom = preDate.compareTo(currentDate);
    //        System.out.println(dateCom);
            long diff = currentDate.getTime() - preDate.getTime();
            int days = (int) Math.floor(diff / (24 * 60 * 60 * 1000));
             System.out.println(days);
    }

  • How do you set the number of rows in a spreadsheet, so that even when you drag data in, in writes over those rows instead of adding a new row?

    How do you set the number of rows you want in a spreadsheet, so that even when you drag data in, in writes over those rows instead of adding a new row?

    After the discovery reported above, I filed this report :
    Bug ID# 10073038
    Summary:
    When Numbers is used on a system with decimal comma a csv file may be good AND wrong
    Steps to Reproduce:
    With Numbers v2, you introduced an interesting enhancement.
    In system using the comma as decimal separator, Numbers requires csv files using the semi-colon as values delimiter.
    In fact it’s true if we OPEN the document dragging its icon on Numbers one or thru the open dialog.
    This said.
    (1) Drag and drop a csv built with the 'semi-colon' standard on a table or on a sheet
    (2) Drag and drop a csv built with the 'comma' standard on a table or on a sheet
    Expected Results:
    Every normally constituted user assume that in
    case (1) he will get a perfectly built table
    case (2) he will get every cells of a row in a single cell
    Actual Results:
    In fact you forgot the drag and drop way of use and in
    case (1) every values separated by semi-colon are inserted in a single cell
    case (2) values separated by comma are correctly spread in a table
    isn’t it ridiculous ?
    Regression:
    Except looking in  QuickView to see which is exactly the structure of the file to decide the way we will insert it in a Numbers document, we may use an applescript fair enough to replace the semi-colons by TAB characters
    or
    to replace the commas by TABs and the decimal periods by commas
    Notes:
    While I am on this subject, I wish to make two proposals:
    (1)  It would be fine to format the date according to the ISO format year-mm-dd when you export a Numbers doc to csv.
    Doing that, dates would be imported correctly in every countries.
    At this time, on an English system, you export as mm/dd/year.
    If the doc is open on a system using the format dd/mm/year, the results will be odd.
    On a system using the format dd/mm/year, you export this way and so, if the doc is open on a system using the format mm/dd/year the results are odd too.
    As every localized versions accept the ISO format (at least on entry), using it in the export scheme would give a correct behavior everywhere.
    (2) It would be fine to add the format Tab Separated Values in the Export pane.
    TSV + ISO date format would give documents opening flawlessly everywhere.
    Yvan KOENIG (VALLAURIS, France) dimanche 4 septembre 2011 21:27:41
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How do you change the spacing between lines of text?

    using Dreamweaver 6 how do you change the spcing between lines of text. Not seeing it as a option in the page properties menu.

    Try CSS line-height property.
    Kenneth Kawamoto
    [link removed by moderator]

  • How do you return the number of Rows in a ResultSet??

    How do you return the number of Rows in a ResultSet? It's easy enough to do in the SQL query using COUNT(*) but surely JDBC provides a method to return the number of rows.
    The ResultSetMetaData interface provides a method for counting the number of columns but nothing for the rows.
    Thanks

    No good way before JDBC2.0. u can use JDBC2.0 CachedRowSet.size() to retrieve the number of rows got by a ResultSet.

  • 1.) How do you find the dictionary in Apple Mail Program?  2.) How do you add another dictionary?

    1.) How do you find the dictionary in Apple Mail Program?  2.) How do you add another dictionary?

    Hello James!
    I do not have any ABAP Instance, only the JAVA one.
    Therefore the ABAP transactions are quite useless.
    The problem tables are created by people working on the CAF layer.
    They have developed and deployed some homemade applications and this is leftovers from their development in some kind of way.
    Anyone with any ideas?
    Could it be that (yet) some special Portal Dictionary Role needs to be asigned to the Administrator?
    /Lasse

  • How can i know the number of lines in field-symbol internal table

    how can i know the number of lines in field-symbol internal table

    Hi,
    If your field symbol has been defined as an internal table :
    Use std describe as
    Data: l type i.
    describe <fs> lines l.
    'l' will contain the number of lines as needed.
    FYI
    The size of this storage area in a field symbols depends on the number of table lines which is not fixed, but determined dynamically at runtime.
    Regards,
    Amit

Maybe you are looking for

  • Not getting required output from XML transform in servlet

    I have an XML document and an XSL stylesheet that will produce the output I require when I use the Xalan in-line parser. However, I cannot manage to do the same in a servlet. I have trawled through loads of examples but can't find anything that works

  • Facebook in safari

    why all of a sudden wont facebook load in safari when everything else will? it wont even load from my history.

  • Publishing as web service an application that connects with Oracle 8i

    Hi. I have to execute a stored procedure in a 8i database (database migration or upgrade is not a possibiity). I have to incorporate this into an ADF 11g App and I've tried it making another project and using the 10g jdbc driver which allows me to ex

  • Offset in exported spool file

    Hi there, I built a report which exports spool files in Excel or TXT files as described here: http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail I the converted file I now get an offset in

  • Does not recognise Ipod connected

    My Ipod nano was working correctly(only 3 weeks old) now when connecting it states it does not recognise Ipod and requests updater. I have gone to site to get updater to V7 as I have V5 and it wont let you download? It requests to "restore to factory