Truncating files

Technocrat
2013-05-25
2013-05-27
  • Technocrat

    Technocrat - 2013-05-25

    Hi, I just download SFK 1.6.7 to try out. I have lots of files (text and binary) and want to delete a fixed number of bytes (same sequence) from the beginning of each file. What's the best way to do this with SFK? Is it replace or partcopy or something else altogether?

    Speaking of partcopy, I see that length has to be specified for the first version of the command. Is it not possible to omit the length so SFK simply copies till the end? Further, do offset values always have to be positive? Can we specify negative values to indicate that the offset is to be calculated from the end of the file?

    Thanks for the help!

     
  • stahlworks

    stahlworks - 2013-05-27

    There is no command to do directly what you describe, and indeed the values must be positive. I will check if the option to omit length can be implemented with reasonable effort.

    A workaround to delete the first 100 bytes of a file may look like this (Type it all as one long command):

    sfk list -size -tabs in.txt 
      +filter -tabform "sfk partcopy $col2 -fromto 100 $col1 out.txt -yes" 
      +run "$text" -yes
    
     

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

Sign up for the SourceForge newsletter:





No, thanks