sfk find limited to displaying and searching only first 146 characters of an input line?

2014-02-26
2014-03-03
  • George Mason

    George Mason - 2014-02-26

    Hi, sfk has nicely hauled me out of a hole where I needed to find and replace a string in .pdf files, for which I thank you.

    However, when I try to use sfk find to look for a string and return the file name and the offending line, it only seems to return the first 146 characters of the line.

    While stabbing around, trying to see what I was doing wrong, it also appeared that sfk find was ignoring anything after character 146, while searching.

    Example:
    C:\testbed>sfk find . file:///

    returns:

    QRS_MSDS_2.pdf :
    <</Subtype>[ 174.42 744.48 194.19 769.92] /BS<</W>>/F 4/A<</Type/Action/S/URI/URI(file:///C:/Data/NNNNNNNNN/WIP/QRS/Hotlink%20test/Ori

    Which has found the string I was after, returned the line but has missed off "ginal%20files%202014-02-25/QRS_Multipage_top.pdf) >>/StructParent 1>>"

    ...which contains the bit we want to refer to.

    Also, if I search for "Ori", it finds the line. If I search for "Original", it doesn't see it.

     
  • stahlworks

    stahlworks - 2014-02-27

    When converting binary input data to text, sfk find collects word with a maximum length of 80 characters by default, so the string "4/A...Ori" is truncated at column 80.
    Try -wrap=190 to change this. As it is now, there is a limit of 190 characters for the -wrap option. It may also happen that words are truncated at the dot "." or ",;" without an option to change that. I will look into the code if this can be improved.

     
    • George Mason

      George Mason - 2014-03-02

      Thanks for that - I'm not sure I'm using the option correctly though. If I enter:

      sfk find -wrap=189 . file:///

      I get the same output, truncated at the same point. I did have a look for wrap in the help, but it didn't seem to be there associated with the find command:

      C:\Data\testbed>sfk ask wrap

      using: wrap
      sfk snapto=outfile [-pure] [-nosub] -dir mydir1 -file .ext1 .ext2
      options
      -wrap[=n] auto-wrap long lines [near column n], e.g. -wrap=80.

      sfk filter [-memlimit=n] -write inoutfile -replacepattern(s)
      text processing options
      -wrap[=n] wrap output lines near console width [or at column n].

      sfk strings [-umlauts] [-wrapbin=n] filename
      at column 80 by default, which can be changed by -wrapbin or -wrap.

      sfk list ... +[f]view [-noshl|-nocol] ["-..."]
      options
      -wrap[=n] wrap lines at column n. currently, this feature

       
  • stahlworks

    stahlworks - 2014-03-02

    i just tried a synthetic test (a line of text preceeded
    by a null byte) which may not be helpful in this case.
    you may try -wrapbin=180 instead, which sets wrapping
    explicitely for binary data (which pdf is). but if that
    doesn't help then it will take some time until i rework the code.

     
  • George Mason

    George Mason - 2014-03-03

    Nope! It didn't I'm afraid. Thanks for looking at this, I've found a workaround using Windows find so I'm OK now.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks