Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Tool to count number bytes in each lines of file

  • 02-05-2000 4:23pm
    #1
    Registered Users, Registered Users 2 Posts: 16,413 ✭✭✭✭


    Lo All,

    I'm looking for a tool to tell me if any of the text files in a certain directory have lines longer than 80 bytes, and if so how many etc.

    Anyone tell me where to start looking? Can I do it with a unix tool like grep or something?

    Cheers,
    Al.


Comments

  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    In Qbasic...
    const filename = "textfile.txt"
    
    open filename for input as #1
    open "report.txt" output as #2
    do while not eof(1)
     linenumber = linenumber + 1
     line input #1, a$
     length = len(a$)
     if length > 80 then 
       print #2, linenumber; " :"; length
     end if
    loop
    reset
    
    



  • Registered Users, Registered Users 2 Posts: 16,413 ✭✭✭✭Trojan


    Cheers,
    you made life a bit easier for me.
    Al.


Advertisement