Trimming whitespace on a badly formatted SFV file.

Before some partition shuffling I made backups to an external HD. Wanting to add a little more comfort to the equation, I ran a recursive SFV on the directories. Having done this in Windows with an older SFV program, a lot of extra whitespace was added into the sfv file, along with the wrong pathname break.

A simple search and replace wouldn’t deal with the variable whitespace length.

This post gave a good suggestion on how to deal with the whitespace.

The trick is to use the ‘tr’ command.

cat Filelist.sfv | tr -s ' ' > Filelist.new

And then I could rename this .new to the .sfv and run my cfv command with the built in modifier to adjust for Windows/DOS based pathnames (i.e ‘\’ vs ‘/’ )

cfv --fixpaths='\' -v
cfv --fixpaths='\' -m

The -m option handles the handful of files (for me, only 5 out of 600+) that had other “multiple whitespace” issues.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>